CT004

Sigil Sentinel Count

HardAcceptance: 0.0%

The Sigil Sentinels guard the eastern wall of Codetikki. Each sentinel can see the sentinels to their right, and reports how many of them are shorter than themselves. Given an array of integers, return a new array where each element at index i is the number of smaller elements to the right of that element in the original input array.

Example 1:

Input: 5 3 4 9 6 1
Output: 1 1 2 1 0

Example 2:

Input: 4 5 2 6 1
Output: 2 1 1 0

Constraints:

1 <= n <= 10^5 -10^9 <= arr[i] <= 10^9

Tags:

arrays binary-indexed-tree divide-and-conquer
Loading...
Test Cases:No test cases
No test cases available.
Coding Problem Not Found | CodeTikki