cpp implementation of 3Sum problem