Solution { public int findContentChildren(int[] greeds, int[] sizes) { Queue<Integer> greedQueue = sortAndQueue(greeds); Queue<Integer> sizesQueue = sortAndQueue(sizes); int happy = 0; while (!greedQueue.isEmpty() && !sizesQueue.isEmpty()) { if (greedQueue.peek() <= sizesQueue.peek()) { greedQueue.poll(); happy++; } sizesQueue.poll(); } return happy; }  int findContentChildren(int[] greeds, int[] sizes);  }
@Test public void exampleInput() throws Exception { Solution solution = new Solution(); int contentChildren = solution.findContentChildren(new int[]{1, 2}, new int[]{1, 2, 3}); assertThat(contentChildren, is(2)); }