LeetCode solutions in C++ generics