I'm gonna follow you , because I wanna do this too , currently studying dsa.
@5foreign34611 күн бұрын
this uses O(n) space not constant
@SagarSingh-wj4pn11 күн бұрын
correct! my guy mistook linear for constant space
@codestreakwithleo10 күн бұрын
Thanks for pointing it out, I missed the O(1) space complexity condition there. Had a further look at the problem again, and it looks like doing the nums[abs(nums[i]) - 1] < 0 approach should work
@Micha-mx8ii9 күн бұрын
What about this? Does this comply with the requirements? result = [] for k in range(len(nums)): if nums[k] in nums[:k]: result.append(nums[k]) return result