Minimum Swaps to Order Items

In HackLand, each item in a shop has a unique popularity rating. The shopkeeper can reorder the items to decrease in popularity from left to right by swapping any 2 items in one operation. Determine t...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: