leetcode better solution