Company: Denso oa
Difficulty: medium
Move Zero Values An array arr of type int is given as an argument of solution function. Write a program that returns an array of type int , where all zero values in arr are moved to the end of the array while preserving the order of non-zero values. Try to implement the program as fast as possible, so that reduces the amount of calculation even when len(arr) becomes large. Constraints 0 ≤ len(arr) ≤ 10000 0 ≤ arr[i] ≤ 10³ Examples Example 1: Input: arr = [0,1,2,3] Output: [1,2,3,0] Description: We need to move the '0' to the end and keep the order of the nonzero values '1,2,3' Example 2: Input: arr = [4,1,0,0,5] Output: [4,1,5,0,0] Description: We need to move the two existing zeros to the end and keep the order of nonzero values