In this problem, tutorials generally carry the idea of storing the last position seen for the green color and then extracting the maximum out of them. My approach is a slight modification; it entails the fact that we can simply double the string and thereafter check for the nearest green color and accordingly update the maximum value, thus traversing only once from left to right. The TC issue is resolved due to the given constraints. Code highlights: 1> using a count variable that begins counting from 'c' and goes on counting until we get the first or nearest 'g'. 2> All the 'c' encountered within the counting process are omitted since they do not contribute to the maximum possible/guaranteed time for waiting for the green signal. 3> Thus, the lookout for the next 'c' begins from the point after the green signal has been encountered for the previous search. For more intuitive understanding and working, it is advised to dry run the code and visualize using the abovementioned logic. 1744C][PROBLEM:1744C - Traffic Light 



