Arrays

Next Greater Element I

easy
The next greater element of some element x in an array is the first greater element to the right of x. You are given two distinct 0-indexed arrays `nums1` and `nums2` where nums1 is a subset of nums2. For each nums1[i], find the next greater element in nums2. If none, use -1. Return an array ans of length nums1.length.
Hint steps(0/2 revealed)
  1. 1

    Complete previous step or reveal to unlock this hint.

  2. 2

    Complete previous step or reveal to unlock this hint.