The Number of elements smaller than 4 on its right side is 2.
The Number of elements smaller than 2 on its right side is 1.
The Number of elements smaller than 1 on its right side is 0.
The Number of elements smaller than 5 on its right side is 0.
Hence the count array is [2,1,0,0]
The first line of input contains an integer 'T' denoting the number of test cases.
The first line of the test case contains 'N' denoting the number of elements in an array.
The next line contains 'N' space-separated integers denoting the elements of an array.
For each test case, return the array where ith element stores the count for ith
element in an array.
You do not need to print anything, it has already been taken
care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 3000
-10^3 <= arr[i] <= 10^3
Where ‘i’ varies from 1 to ‘N’ where 'N' is the length of the array.
Time Limit: 1 sec
The main idea is for every element to count the number of elements less than ARR[i] on its right using a loop.
Algorithm:
Negative To The End
Sort 0s, 1s, 2s
Day 28 : Fake Coin Problem
Day 28 : Fake Coin Problem
Search In A Rotated Sorted Array II
Find Duplicate in Array