find two value sum in an array that matches a target number
Anonymous
First iteration: scan through the list of numbers and store them in a hash array. complexity - O(n) Then scan through the list again , for every element 'i' check if (sum - i) is present? If so that is the solution if not present move on to the next element. - complexity : O(n) Total complexity: O(n)
Check out your Company Bowl for anonymous work chats.