
As we can see from the example below we are only able to put two stacks in the locker so our answer will be 2.


The first line of input contains an integer 'T' representing the number of test cases.
The first line of each test case contains two space-separated integers ‘N’ and ‘M’ denoting the size of ‘CASH’ and ‘LOCKER’ arrays respectively.
The second line of each test case contains ‘N’ space-separated integers denoting the elements of ‘CASH’.
The third line of each test case contains ‘M’ space-separated integers denoting the elements of ‘LOCKER’.
For each test case, print the maximum number of cash stacks that ninja can put in the locker.
The output of each test case will be printed in a separate line.
1 <= T <= 5
1 <= N,M <= 5000
1 <= CASH[i], LOCKER[i] <= 10^9
Where ‘T’ is the number of test cases, ‘N’ and ‘M’ is the size of ‘CASH’ and ‘LOCKER’ respectively, and 'CASH[i]' and 'LOCKER[i]' denotes the 'i-th' elements of the array.
Time limit: 1 sec
You do not need to print anything, it has already been taken care of. Just implement the given function.
The idea here is to put the smallest possible cash stack in the locker first and if no stack is available then we check the next section.
To implement this we first need to make a valid locker ‘VALIDLOCKER’ in which if VALIDLOCKER[i] < VALIDLOCKER[i+1], then the maximum height of section VALIDLOCKER[i+1] is VALIDLOCKER[i].
After this we will iterate ‘LOCKER’ section one by one and find the minimum possible cash stack to put in this section.
Algorithm:
The idea here is to use greedy technique, that is we will first put the smallest stack in the locker and if all stack size are greater than the size of the locker section then return the ans.
To implement this we first need to make a valid locker ‘VALIDLOCKER’ in which if VALIDLOCKER[i] < VALIDLOCKER[i+1], then the maximum height of section VALIDLOCKER[i+1] is VALIDLOCKER[i].
After this we will sort the CASH array and check till when we can insert the cash stack in the VALIDLOCKER.
Algorithm: