Amazon Interview Question

Similar to leetcode three sum