Every second element

Report a typo

Restore the code which returns a subset containing every second element from the original set.

fun <T> ArraySet<T>.half(): ArraySet<T> {
    val half = ArraySet<T>(size / 2)
    for (i in 0 until size step 2)
        half.add(__________)
    return half
}
Enter a short text
___

Create a free account to access the full topic