Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def extractEachKth(inputArray, k)
- array_length = inputArray.length
- new_array = Array.new
- x = 0
- y = 0
- z = k
- while (x < array_length)
- if x != z - 1 then
- new_array[y] = inputArray[x]
- y = y + 1
- else
- z = z + k
- end
- x = x + 1
- end
- return new_array
- end
Advertisement
Add Comment
Please, Sign In to add comment