Problem Name: Next Greater Element I
Problem Statement: Given two arrays of integers
nums1nums2nums2nums1More formally, given a list of numbers
nums2indicesnums1nums2Rules and Constraints:
- The function should return a list of indices where elements from are in
nums2in ascending order of their corresponding indices, and each index is a position within the listnums1.nums1 - For each index in where the element in
nums1is the largest element, the answer will be -1.nums2
Notes: This problem assumes that the input arrays are valid, with
nums1nums2Input/Output Format: Two arrays,
nums1nums2nums2nums1nums1Example
Input: {"nums1":[4,1,2],"nums2":[1,3,4,2]} Output: [-1,3,-1]
CompaniesMicrosoft
JavaScript
Login to write code
Solve problems, verify your skills, and earn XP.