60. Move zeroes

EasyProgramFree10 points

Write moveZeroes nums, which returns nums with all its zeros moved to the end. The other values keep their relative order.

Examples

  1. Input: moveZeroes [0, 1, 0, 3, 12]Output: [1, 3, 12, 0, 0]
  2. Input: moveZeroes [0]Output: [0]

Submitting also runs 5 hidden tests.

Solution.lean
Loading editor…

Run checks your code against the examples and your custom inputs and records nothing. Submit also runs the hidden tests, confirms the axioms your proof uses and records the result. Each uses one compiler check.

ReadyLn 1, Col 1Lean 4
Draft saved in this browser