You are viewing a single comment's thread. Return to all comments →
f# solution
open System let rec find res left right = match (left, right) with | ([], rs) -> [ List.rev res; []; rs ] | (ls, []) -> [ List.rev res; ls; [] ] | (l :: ls, r :: rs) when l = r -> find (l :: res) ls rs | (l :: _, r :: _) when l <> r -> [ List.rev res; left; right ] [<EntryPoint>] let main _ = let left = Console.ReadLine() |> Seq.map string |> List.ofSeq let righ = Console.ReadLine() |> Seq.map string |> List.ofSeq find [] left righ |> List.map (fun results -> (results |> List.length |> string) + " " + (results |> String.concat "")) |> List.map Console.WriteLine 0
Seems like cookies are disabled on this browser, please enable them to open this website
Prefix Compression
You are viewing a single comment's thread. Return to all comments →
f# solution