3sum, time limit exceeded solution