leetcode039