| Problem Statement | |||||||||||||
| Librarians prefer mental exertion to manual labor. When a librarian confronts a disordered shelf of books, he restores it to order using the smallest possible number of moves. With each move, he takes out a book and reinserts it so that neighboring books slide right and left as necessary. You are given a String[] containing the titles of a shelf's worth of books in their current order. Return the minimum number of moves required to sort them by case-sensitive lexical order of their titles. | |||||||||||||
| Definition | |||||||||||||
| 
 | |||||||||||||
| Notes | |||||||||||||
| - | The standard string comparators of C++, Java, C#, and VB.Net perform case-sensitive lexical comparison. | ||||||||||||
| - | Do not strip any blank character from any title. | ||||||||||||
| Constraints | |||||||||||||
| - | titles contains between 1 and 20 elements, inclusive. | ||||||||||||
| - | Each element of titles will contain between 1 and 50 characters, inclusive. | ||||||||||||
| - | Each character of each element of titles will be a letter ('a'-'z' or 'A'-'Z') or a space (' '). | ||||||||||||
| Examples | |||||||||||||
| 0) | |||||||||||||
| 
 | |||||||||||||
| 1) | |||||||||||||
| 
 | |||||||||||||
| 2) | |||||||||||||
| 
 | |||||||||||||
| 3) | |||||||||||||
| 
 | |||||||||||||
| 4) | |||||||||||||
| 
 | |||||||||||||
| 5) | |||||||||||||
| 
 | |||||||||||||