I seem to be having trouble properly understanding the requirement of this question.
As per the following example, for
num1, the next greater number in
3. Why is it not
2 ? Is it because
2 already exists in
Input: nums1 = [4,1,2], nums2 = [1,3,4,2]. Output: [-1,3,-1] Explanation: For number 4 in the first array, you cannot find the next greater number for it in the second array, so output -1. For number 1 in the first array, the next greater number for it in the second array is 3.
Thanks for any help.
@hckrtst :Also by the same logic for 2 it should be '4' but the answer says '-1'.