X47: withoutTen

Given an int[] array, write a function that returns an array where all the 10's have been removed. The remaining elements should shift left towards the start of the array as needed, and the empty spaces at the end of the array should be set to 0. So {1, 10, 10, 2} yields {1, 2, 0, 0}. You may modify and return the given array or make a new array.

Examples:

withoutTen({1, 10, 10, 2}) -> {1, 2, 0, 0}

Your Answer:

Feedback

Your feedback will appear here when you check your answer.