Tushar Koundal’s Post

day 6: LeetCode 283. Move Zeroes make new array approach -> make a new array , store non zero element at starting positions rest remaining positions will have default value zero already or you can fill it your self. totally in-place arrray -> store every non zero element set it to starting positions of original array using a pointer , reamining position after external pointer will always be zero so set it to zero by running a loop from ptr -> nums.length, reduced space complexity to O(1) as previous solution had space complexity of O(n). #day6of150daysofcode #150daysofcode #Java #leetcode #dailycode

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories