LeetCode template solution for c++