Algorithm · Uber · Medium
You are given an integer array nums. Rearrange it so that every occurrence of 0 is placed before every non-zero value. The non-zero values must retain exactly the same relative order they had in the original array. The rearrangement must be performed by modifying nums directly, using only a constant amount of additional memory. Return nums after the in-place update. Example 1: Explanation: The zeros move to the front, while 3, 8, 2, and 6 stay in their original relative…
Checking your access…