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.
# Hackerrank - Filter Positions in a ListdefmoduleSolutiondodefpread_list,do:IO.read(:stdio,:all)|>String.split([" ","\n"])|>Enum.map(fnx->String.to_integer(x)end)defmain()doread_list()|>Enum.with_index|>Enum.filter(fn{_,index}->rem(index,2)==1end)|>Enum.map(fn{value,_}->IO.putsvalueend)endendSolution.main()
Please improve it if possible.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Filter Positions in a List
You are viewing a single comment's thread. Return to all comments →
In Elixir:
Please improve it if possible.