slove algorithm problems from Leetcode