Tag Archives: balanced tree

Count smaller elements on the right

Given an array of Integer. Find number of smaller elements at each position. Array may have duplicate elements. The brute force solution for this problem would be to traverse the array from right to left and count number of smaller element on the right in O(n^2). Faster Implementation I have described in a previous post how to […]