Minimum steps to set a series of rotating dials to a given sequence
So I have the following problem: There are n rotating dials each set to some number between 0-9 and they need to be matched with another series of n numbers(also between 0-9). One step of rotation is rotating any number of consecutive dials up or down by one step. The dials wrap around 9. i.e. rotating one step up from 9 gives 0 and vice versa. I need to find the minimum number of steps to match the initial configuration with the given configuration. Ex: Initial -> 154 Given -> 562 1. first move first 2 dials up by 1 154 -> 264 ->1 step 2. move 1st dial 3 up 264->564 ->3 steps 3. move 3rd dial