Given two values X and Y. You need to convert X to Y by performing various steps.

Question:

Given two values X and Y. You need to convert X to Y by performing various steps. In a step, we can either multiply 2 to the value or subtract 1 from it. You need to display the number of steps and the path. To reach 3 from 1, the path will be [1, 2, 4, 3] and number of steps will be 3.

Create an array to keep track of the number of steps and another array to keep track of parent value.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: