← 返回 ibm 的题目列表Maximize pairs (a[i], b[j]) with a[i] > b[j]
类型:online_judge
ibm
Given two arrays a and b, where both arrays contain integers. Your task is to find the maximum number of pairs (a[i], b[j]) such that a[i] > b[j]. Design an algorithm and provide the time complexity and space complexity analysis.
Input:
Array a containing n integers.
Array b containing m integers.
Output:
An integer representing the maximum number of satisfying pairs.
Constraints:
1 <= n, m <= 10^5
-10^9 <= a[i], b[j] <= 10^9
Example:
Input: a = [3, 5, 1] b = [2, 1, 4] Output: 3
Input: a = [1, 2, 3] b = [3, 4, 5] Output: 0
Example
Input
3 5 1
2 1 4