You are viewing a single comment's thread. Return to all comments →
You can also use the following.. I like to follow KISS for hacker rank quite often.
def f(arr:List[Int]):List[Int] = { val inputArraySize = arr.size - 1 val indicesToDrop: Range = 1 to inputArraySize by 2 return indicesToDrop.map((idx: Int) => arr(idx)).toList }
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 →
You can also use the following.. I like to follow KISS for hacker rank quite often.