Skip to content

Latest commit

 

History

History
5 lines (5 loc) · 431 Bytes

File metadata and controls

5 lines (5 loc) · 431 Bytes

Count-Smaller-Elements-on-right-side

Write a program to count number of smaller elements on right of each element in an array. Given an unsorted array arr[] of distinct integers, construct another array countSmaller[] such that countSmaller[i] contains count of smaller elements on right side of each element arr[i] in array.

Example:

Input: arr[] = {12, 1, 2, 3, 0, 11, 4} Output: countSmaller[] = {6, 1, 1, 1, 0, 1, 0}