Personal soluution to leetcode using Java.