AlgorithmsCodilityPatternsTutorials

HackerRank sorting hard! https://www.hackerrank.com/challenges/insertion-sort

This one times out:

And then it hit me, we can use merge sort (O(n log(n))) and simply count the shifting, returning the total number of shifts instead of the array.

So here it goes: