Showing:
Handle Score
@Ibrahim Nash 5761
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4944
@saiujwal13083 4506
@sanjay05 3762
@marius_valentin_dragoi 3516
@sushant_a 3459
@verma_ji 3341
@KshamaGupta 3318
Fitting The Array
Easy Accuracy: 23.53% Submissions: 17 Points: 2

Adobe is playing an array game. He is weak in the concepts of arrays. Adobe is given two arrays a[ ] and b[ ] of the same size. The array a[ ] will be said to fit in array b[ ] if by arranging the elements of both array, there exists a solution such that i_th element of a[ ] is less than or equal to an i_th element of b[ ]. Help Adobe find if the given arrays are fit or not.

Example 1:

â€‹Input : A[] = {7, 5, 3, 2} and
B[] = {5, 4, 8, 7}
Output : YES
Explanation:
Transform A = {2, 3, 5, 7} and
B = {4, 5, 7, 8}. then both array will
fit in between.


â€‹Example 2:

Input : A[] = {1, 2, 3} and B[] = {1, 2, 3}
Output :  YES 

This is a function problem. The input is already taken care of by the driver code. You only need to complete the function isFit() that takes an array (a), another array (b), sizeOfArray (n), and return true if array a[ ] fit in array b[ ] otherwise print false. The driver code takes care of the printing.

Expected Time Complexity: O(N*LOG(N)).
Expected Auxiliary Space: O(1).

Constraints:
1 ≤ N ≤ 105
0 ≤ a[i], b[i] ≤ 105