Approach hintTry it first, then revealHide
Handle the circular array by iterating i from 0 to 2n - 1 and using i % n. A decreasing stack of unresolved indices receives its answers whenever a larger value arrives.
Handle the circular array by iterating i from 0 to 2n - 1 and using i % n. A decreasing stack of unresolved indices receives its answers whenever a larger value arrives.