May I know that why my solution is wrong(Python)? Thank you so much


  • -1

    class Solution(object):
    def moveZeroes(self, nums):
    """
    :type nums: List[int]
    :rtype: void Do not return anything, modify nums in-place instead.
    """

        lista=[i for i in nums if i!=0]
        list0=[i for i in nums if i==0]
        nums=lista+list0
    

    I tried it in Jupyter and it returns the correct answer


Log in to reply
 

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