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
#Best Case, target at arr[0], loop runs once, Time Complexity O(1)
#Worst Case, target not in the list, loop runs n times, Time Complexity O(n)
#Average Case, target at arr[1]-arr[n], loop runs at least twice or at most n times, Time Complexity remains O(n) (Constant not considered, n/2 changes to n)
#Since we are not using any extra data structure therefore the space complexity will be O(1)