Learn
Practice
Newsletter
Resources
F
Toggle theme
0
F
Toggle theme
0
Toggle menu
← Back to All Animations
Count of Smaller Numbers After Self
Bookmark
Input
Standard
Sorted Desc
With Duplicates
Already Sorted
Custom
nums
=
[5, 2, 6, 1]
nums
5
0
2
1
6
2
1
3
BIT
0
1
0
2
0
3
0
4
0
5
0
6
result
-
0
-
1
-
2
-
3
algo
master
.
io
Step:
Initialize BIT of size 6. Offset = 0 (so min value 1 maps to index 1). Traverse nums right to left.
0 / 33
Input
Standard
Sorted Desc
With Duplicates
Already Sorted
Custom
nums
=
[5, 2, 6, 1]
0 / 33
nums
5
0
2
1
6
2
1
3
BIT
0
1
0
2
0
3
0
4
0
5
0
6
result
-
0
-
1
-
2
-
3
algo
master
.
io
Step:
Initialize BIT of size 6. Offset = 0 (so min value 1 maps to index 1). Traverse nums right to left.