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)