solution for leetcode problems