Groupon SDE

Status: New grad, MS CS Top 100 CS school
Position: SDE at Groupon
Location: Seatle WA
30 mins phone screen -
1 hour technical interview
Questions related to work experience about previous Interships and project related
Technical questions-

Four Sum Pairs from Array which adds to target
Find the min. depth of tree
Solutions:

 public List<List<Integer>> fourSum(int[] nums, int target) {
        List<List<Integer>> list = new LinkedList<>();
        if (nums.length < 4) return list;
        Arrays.sort(nums);
        for (int a = 0; a < nums.length - 3; ++a) {
            if (a > 0 && nums[a] == nums[a - 1]) continue;
            for (int b = a + 1; b < nums.length - 2; ++b) {
                if (b > a + 1 && nums[b] == nums[b - 1]) continue;
                int c = b + 1, d = nums.length - 1;
                while (c < d) {
                    int sum = nums[a] + nums[b] + nums[c] + nums[d];
                    if (sum < target) { ++c; continue; }
                    if (sum == target) { list.add(Arrays.asList(nums[a], nums[b], nums[c], nums[d])); ++c; }
                    do { --d; } while (c < d && nums[d] == nums[d + 1]);
                }
            }
        }
        return list;
    }
		
public int minDepth(TreeNode root) {
        if(root == null) return 0;
        int left = minDepth(root.left);
        int right = minDepth(root.right);
        return (left == 0 || right == 0) ? left + right + 1: Math.min(left,right) + 1;
       
    }