In a CodeSignal challenge, you need to find all pairs in an array that sum to a target value. Which data structure gives the most efficient average-case solution?
-
A
Sorted array with binary search
-
B
Hash set for complement lookup
-
C
Nested loops with early exit
-
D
Priority queue