Tags: idea assignment array access access. com pointer amp is a direct
Own ideas:
/* First Appearance 0 */
/* Record the number of consecutive 0 N */
/* Second occurrence 0 record position */
/* Move all elements before the second 0 to the left n*/
/* Return to step two */
/* Finally assign all remaining positions to the 0*/
Problems encountered in the implementation:
1, array access out of bounds,&& operator order, first cannot cross
2, record the number of 0, carefully consider the position
On-Line ideas:
This type of array in-situ delete the data, the study is two pointer application, pay attention to grasp the idea of two pointers, this kind of problem can be solved.
Conclusion:
Suddenly, the array elements can be directly assigned to the double pointer problem.
Reference: HTTPS://WWW.JIANSHU.COM/P/05338B2180A1
Leetcode Move Zero