Is this in place


  • 2
    I
    class Solution(object):
    def moveZeroes(self, nums):
        """
        :type nums: List[int]
        :rtype: void Do not return anything, modify nums in-place instead.
        """
        for element in nums:
            if element == 0:
                nums.remove(element)
                nums.append(0)

  • 0
    I

    this is not in place.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.