Search⌘ K

Next Element Greater than Subset

Find the next greater element for each value in the subset array.

Statement

Given two integer arrays, nums1 and nums2, where nums1 is a subset of nums2, find the next greater element of some element x in nums2 that is to the right of x in the same array. If there is no next greater element, then the answer is 1-1.

Constraints

  • 1 <= nums1.length <= nums2.length <= 1000
  • 0 <= nums1[i], nums2[i] <= 10000
  • All integers in
...