Solution 1 can pass small case, Solution2 is the right solution