Do you want a story?
No! Let's get straight to business.
You are given an array of N strings, You need to sort the array in lexicographical order. Only move allowed while sorting is you can only swap strings at adjacent positions.That means
You can swap -
1. String Ai with String Ai+1
2. String Ai with String Ai-1
You need to output the minimum number of moves it will take to sort the Array.
An integer N(<=1000) denoting the size of the array.
N strings on every next line, where ith string denotes string Ai(length of each string<=10)
An integer denoting the minimum number of moves.
It will take 4 moves to move Arya from 5th to 1st position.