Problem 1 is trivial:

```
public char findTheDifference(String s, String t) {
int[] count = new int[128];
for (char ch : t.toCharArray())
count[ch] += 1;
for (char ch : s.toCharArray())
count[ch] -= 1;
char ans = 'a';
for (int i = 0; i < 128; i++) {
if (count[i] != 0)
ans = (char) i;
}
return ans;
}
```

Problem 2:

We can get rid of half of the number for each round, the key idea is to find the starting number of the next round.

```
public int lastRemaining(int n) {
int remaining = n;
int start = 1;
int step = 2;
boolean left = true;
while (remaining > 1) {
remaining = remaining / 2;
if (left)
start = start + step * remaining - step / 2;
else
start = start - step * remaining + step / 2;
step *= 2;
left = left ? false : true;
}
return start;
}
```

Problem 3:

**This is not a correct solution see @stachenov counter example below.**

~~We need to check both vertically and horizontally if the accumulated heights and width can form a rectangle. Overral running time is O(m + n).~~

The OJ has a missing test case: { 1, 1, 4, 4 }, { 1, 3, 4, 5 }, { 1, 6, 4, 7 }. These 3 rectangles can not form a rectangle, some buggy code can still pass all test cases.

Another missing test case: {{1, 1, 2, 2}, {2, 1, 3, 2}, {2, 1, 3, 2}, {2, 1, 3, 2}, {3, 1, 4, 2}}