Google interview question

1. 3sum, 2. permutation