Back to course home
0% completed
Vote For New Content
Why do values to the left of value at index i not matter?
willumeh
Nov 25, 2024
So, I understand that we are taking a three sum and manipulating it to look similar to a two sum, there the sum will equal -targetsum , where targetsum is the item at index i. My question is why does the value to the left of index i not matter?
1
0
Comments
Comments
Kartiki Sharmaa year ago
After sorting the input array, looking at the left of index i would mean re-visiting values previously visited.
E.x.
[-1,0,1,2,-1,-4] # original input
[-4, -1, -1, 0, 1, 2] # after sorting, and the one iterating on
- when -4 is fixed all the other elements will be ...
On this page