100 doors: Difference between revisions

(Added an Agena sample)
Line 4,191:
=={{header|Kotlin}}==
<lang Kotlin>fun oneHundredDoors(): List<Int> {
val doors = Array<Boolean>BooleanArray(100, { false })
 
for (i in 0..99)
Line 4,197:
doors[j] = !doors[j]
 
return IndexIterator(doors.iteratorasSequence()).mapIndexed { i, b -> i to b }.filter { it.second }
.map { it.first + 1 }.toList()
.toList()
}</lang>