Counting Elements In Two Arrays

medium
Given two unsorted arrays arr1[] and arr2[]. They may contain duplicates. For each element in arr1[] count elements less than or equal to it in array arr2[].

Input Format

Input is managed for you

Output Format

Output is managed for you

Constraints

1 <= m,n <= 10^5
1 <= arr1[i],arr2[j] <= 10^5

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
6
1 2 3 4 7 9
6
0 1 2 1 1 4
Output
4 5 5 6 6 6
Previous
Count Zeros In A Sorted Matrix
Next
Facing The Sun

Related Questions