Problem 503 · Medium

Next Greater Element II

Given a circular integer array nums, return the next greater number for every element. The next greater number of x is the first greater number to its traversing order next, searching circularly; if it does not exist, return -1.

Open the interactive visualisation