Yufei's LeetCode Solution