leetcode solution C++