Leetcode Advanced Algorithms Java