Counting Elements In Two Arrays

easy
1. You are given two unsorted arrays arr1 and arr2 of sizes M and N respectively.
 2. For each element in arr1, you have to print the count of count elements in array arr2[] less than or equal to it.
 3. For example,
 Input: arr1 = {1,2,3,4,9} and arr2 = {0,1,2,1,1,4}
 
 Output: 4 5 5 6 6
 
 Note:
 1. main takes input from the users.
 2. display is a utility function that displays an array. Feel free to use it for debugging purposes.
 3. This is a functional problem.
 4. You have to complete the function countEleLessThanOrEqual. It takes as input two arrays and their sizes. It should print the required output.

Input Format

First line takes input M and N, the length of the given arrays. Second line takes input M space separated integers representing the elements of the first array. Third line takes input N space separated integers representing the elements of the second array. Input is handled for you.

Output Format

The required counts. Output is NOT handled for you.

Constraints

N/A

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
5 6 
1 2 3 4 9   
0 1 2 1 1 4
Output
4 5 5 6 6
Previous
Allocate Minimum Number Of Pages
Next
Count Possible Triangles

Related Questions