We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Here is how to read the stdin for this question in Ocaml:
letfnarr=(* implementation *)let()=(* first line is parsed as the first arg to f *)letnum=int_of_string(read_line())in(* the rest until EOF are parsed into an array for second arg *)fnum(letrecauxarr=tryletinput=read_line()inmatchinputwith|""->arr|a->aux(arr@[int_of_stringa])withEnd_of_file->arrinaux[])
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Filter Array
You are viewing a single comment's thread. Return to all comments →
Here is how to read the stdin for this question in Ocaml: