Leetcode Advanced Algorithms Previous Question