orangy
private fun josephus(size: Int, step: Int): Int {
val circle = (0..size - 1).toMutableList()
var index = step % circle.size
while (circle.size > 1) {
circle.removeAt(index)
index = (index + step - 1) % circle.size
}
return circle[0]
}