This solution uses an array and skips unreachable target sums at each iteration (through the use of the continue
statement).
You can also use a HashMap and only iterate through all existing keys, which is theoretically faster but slower in practice. It is theoretically more efficient because you don't have to iterate through all 2 * sum + 1
indices in the array at each iteration of the nums
array; however, it seems that the overhead of using the HashMap data structure
far outweighs the cost of performing that iteration.

83.83th percentile: we're finally getting somewhere!