java_solution

Due to recursive limitation in Python, try to write in Java