Solution for problem [4Sum]