Retired
Remove Zeros (retired)
6,529 of 6,542AustinBrunkhorst
Description:
Write a function that takes an array of values and moves all elements that are zero to the end of the array, otherwise preserving the order of the array. The zero elements must also maintain the order in which they occurred.
For example, the following array
[7, 2, 3, 0, 4, 6, 0, 0, 13, 0, 78, 0, 0, 19, 14]
is transformed into
[7, 2, 3, 4, 6, 13, 78, 19, 14, 0, 0, 0, 0, 0, 0]
Zero elements are defined by either 0
or "0"
. Some tests may include elements that are not number literals.
You are NOT allowed to use any temporary arrays or objects. You are also not allowed to use any Array.prototype
or Object.prototype
methods.
Arrays
Sorting
Algorithms
Similar Kata:
Stats:
Created | Dec 13, 2013 |
Warriors Trained | 15151 |
Total Skips | 2341 |
Total Code Submissions | 80968 |
Total Times Completed | 6542 |
JavaScript Completions | 6529 |
Total Stars | 353 |
% of votes with a positive feedback rating | 84% of 839 |
Total "Very Satisfied" Votes | 623 |
Total "Somewhat Satisfied" Votes | 164 |
Total "Not Satisfied" Votes | 52 |