Perfect Squares Leetcode Solution