Skip to content

Latest commit

 

History

History

count-pairs-in-two-arrays

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

< Previous                  Next >

Related Topics

[Array] [Binary Search] [Sorting]

Hints

Hint 1 We can write it as nums1[i] - nums2[i] > nums2[j] - nums1[j] instead of nums1[i] + nums1[j] > nums2[i] + nums2[j].
Hint 2 Store nums1[idx] - nums2[idx] in a data structure.
Hint 3 Store nums2[idx] - nums1[idx] in a different data structure.
Hint 4 For each integer in the first data structure, count the number of the strictly smaller integers in the second data structure with a larger index in the original array.