I believe the code below is an O(N) solution but I'm being told it is O(N^2) because of the in
keyword. Is that true?
Code:
class Solution:
def twoSum(self, nums, target):
for i,v in enumerate(nums):
value = target - v
if value in nums and nums.index(value)!= I:
return (nums.index(value),I)
break