solved four leetcode problem