We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Believe it or not there is a divide and conquer solution in O(n*log(n)). Find inversions in O(n*logn) using a merge sort variant in the accumulation array a where a[i] = sum of all elements from 0 to i.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Subarray
You are viewing a single comment's thread. Return to all comments →
Believe it or not there is a divide and conquer solution in O(n*log(n)). Find inversions in O(n*logn) using a merge sort variant in the accumulation array a where a[i] = sum of all elements from 0 to i.