the great element element x array great element right x arrayyou give distinct 0indexed integer array nums1 nums2 nums1 subset nums2For 0 nums1length find index j nums1i nums2j determine great element nums2j nums2 if great element answer query 1return array ans length nums1length ansi great element describe Example 1input nums1 412 nums2 1342output 131explanation the great element value nums1 follow 4 underlined nums2 1342 there great element answer 1 1 underline nums2 1342 the great element 3 2 underline nums2 1342 there great element answer 1example 2input nums1 24 nums2 1234output 31explanation the great element value nums1 follow 2 underlined nums2 1234 the great element 3 4 underline nums2 1234 there great element answer 1 Constraints1 nums1length nums2length 10000 nums1i nums2i 104All integer nums1 nums2 uniqueall integer nums1 appear nums2 Follow could find Onums1length nums2length solution