Traverse all array elements in reverse order order == ' G ' we compute next greater elements of every element order == ' S ' we compute right smaller element of every element
for i in range ( n - 1 , - 1 , - 1 ) : NEW_LINE