[C++] Triangles Puzzle for Interview