This solution was designed to be too slow. Unfortunately, java I/O is so slow that O(N) Java solutions take longer to run than O(N^2) C++ solutions. So I have removed this solution from the time_limit_exceeded directory.