leetcode 8.6