[Python] nums[:] = unique anyone please explain this line of code

Discussão em 'Python' iniciado por Stack, Abril 12, 2025.

  1. Stack

    Stack Membro Participativo

    class Solution(object):
    def removeDuplicates(self, nums):


    unique = []
    for num in nums:
    if num not in unique:
    unique.append(num)

    nums[:] = unique
    return len(nums)

    Continue reading...

Compartilhe esta Página