Shortest Path with Alternating Colors | LeetCode 1129 | C++