Problem 454 · Medium

4Sum II

Count index tuples that take one value from each of four arrays and sum to zero. The visual builds a table of pair sums from the first two arrays, then checks each sum from the other two against its negation.

Open the interactive visualisation