You're solving for indices and . Rearrange to see what you need:
This tells you: for each number in the array, check if the complement () exists elsewhere in the array. This algebraic rearrangement is the key insight.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
What you're solving
You're solving for indices and . Rearrange to see what you need:
This tells you: for each number in the array, check if the complement () exists elsewhere in the array. This algebraic rearrangement is the key insight.