solution to leetcode puzzles