I have been practicing problem solving and I cant seem to get anywhere for this one...
Imagine I have an array like: {1, 2, 4 ,3}. The only operation I can perform is moving the value at the 0th index somewhere else in the array. This is not a swap operation, the value simply "squeezes" itself between two other numbers. What is the minimum number of these operations I can make to sort the array. In the given example, the solution would be 3...
- (1, 2, 3, 4) => (2, 4, 1, 3) => (4, 1, 2, 3) => (1, 2 ,3, 4)
============================================================
It is similar to this problem: https://www.geeksforgeeks.org/count-minimum-number-move-front-moves-sort-array/
But I can only move items from the front instead of bringing them to the front.
I appreciate any help or tips to point me in the right direction. This one has been annoying me for a few days. Thanks!