It is pointless to keep on calling the searchPair function upon the sign change, the array is sorted. Let’s say the first positive number is 5, i will not find Y and Z that yield me a -5 after that because my array is sorted.
Course: Grokking the Coding Interview: Patterns for Coding Questions - Learn Interactively
Lesson: Triplet Sum to Zero (medium) - Grokking the Coding Interview: Patterns for Coding Questions