Search⌘ K
AI Features

Next Greater Element II

Try to solve the Next Greater Element II problem.

We'll cover the following...

Statement

Given a circular integer array nums where the next element of nums[nums.length - 1] wraps around to nums[0], return an array containing the next greater element for each element in nums.

The next greater element of an element nums[i] is the first element that is strictly greater than nums[i], found by traversing the array in order starting from nums[i]'s position, with circular wraparound allowed. If no such element exists, return ...