Problem 3595 · Medium

Once Twice

In an integer array one value occurs once, one occurs twice and every other value occurs three times. Return [the value seen once, the value seen twice] in linear time with constant extra space.

Open the interactive visualisation