You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose the input array is a sequence from 1 to n without duplicates, and the value for n is 2.
Since each value appears only once, when the for is processing the last value of the input the ans.count(num) will compare n-1 times, this yields the n^2
Is the time complexity of the naive method also linear time instead of quadratic ?
The text was updated successfully, but these errors were encountered: