nums = [-1, 2, 3, 5, 7, 9, 9, 9, 11, 1]
nums[:] = set(nums)
#the output for nums is now {1, 2, 3, 5, 7, 9, 9, 9, 11, -1}
I am not sure why calling set moves -1 to the end instead of keeping the code in order. In order to get my desired output I am calling the below code
nums[:] = sorted(set(nums))
For the time complexity of this, calling set() on something would be O(n) and also calling sorted() on something would be O(n) so in total the output would be O(n^2)