Hi there,
Am practicing arpil month's 30 day leetcode cchallenge and am confused about the first problem.
am trying to implement this code and it's saying that the timit limit exceeded.
Thing is, this code's time complexity when i checked is far more better than many other codes. But i don't know why the time limit exceeds even though it satisfies all test cases.
class Solution:
def singleNumber(self, nums: List[int]) -> int:
ans=0
for num in nums:
if(nums.count(num)==1):
ans=num
return ans