Algorithm · Pinduoduo · Easy
You are given two integer arrays nums1 and nums2 where nums1 is a subset of nums2. That is, every value that appears in nums1 also appears somewhere in nums2. For each element in nums1, locate its position within nums2. Then, from that position, scan to the right and find the very first element that is strictly larger than the current element. If no such larger element exists to the right, the answer for that element is -1. Return an array answer such that answer[i] holds…