My solution is like this:
count = nums.count(0)
if count != len(nums) and count != 0:
for i in nums: if i == 0: nums.remove(i) for i in range(count): nums.append(0)
leetcode returns an error like this:
Why this happened and how to solve it?? Thx a lot
I just solved it, here's my solution.
for n in range(len(nums)-1,-1,-1):
if(nums[n] == 0):
Well , I m guilty of this too . but do you guys think we can use the inbuilt functions remove & append ?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.