Problem 4071 · Medium

Minimum Rotations to Dial a Number II

Before dialing, you may reverse one tail of the digit string. Price every tail reversal in one sweep, since only its link into the prefix changes.

Open the interactive visualisation