Master the Remove Element Problem (LeetCode 27)

Поділитися
Вставка
  • Опубліковано 6 січ 2025

КОМЕНТАРІ • 2

  • @thegreatperson27
    @thegreatperson27 22 години тому +1

    Why not:
    return [item for item in nums if item!= val]

    • @anantakesharipanda4085
      @anantakesharipanda4085 20 годин тому

      You I tried it, doesn’t work. The platform is reading the first k elements of the original array and checking if those contain val or not. Also, the return value has to be in an int, not a list.