79683552

Date: 2025-06-29 07:08:01
Score: 3.5
Natty:
Report link

I'm having the same issue, I was trying to solve a leetcode problem. Given array nums = [0, 0, 1, 1, 1, 2, 2, 3, 3, 4]. I want to return unique number and remove all duplicates

I got [0, 1, 2, 3, 4, 2, 2, 3, 3, 4], then I sliced it using nums[:5] then I got an error:

TypeError: [1, 2] is not valid value for the expected return type integer[]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    raise TypeError(str(ret) + " is not valid value for the expected return type integer[]");
Line 55 in _driver (Solution.py)
    _driver()
Line 64 in <module> (Solution.py)
During handling of the above exception, another exception occurred:
TypeError: slice indices must be integers or None or have an __index__ method
                         ~~~~~~~^^^^^^
    out = ser._serialize(param_1[:ret], 'integer[]')
Line 52 in _driver (Solution.py)
Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Me too answer (2.5): I'm having the same issue
  • Low reputation (1):
Posted by: user26565908