leetcode 7.29