Solutions and test cases for LeetCode in Java
String.charAt() is slower, convert to the char array instead.