Scan nums2 right-to-left with a decreasing stack, seeding each value's next greater into a hash-map, then answer nums1 queries in O(1).