Login and get codingInspired by the movie

Transformer, John decides to design a "number transformer" as a test.It is capable to perfom the transformation of the number 1 (one is the base) to any "target" number.

The two allowed operations/rules are:

- multiply by 2
- int divide by 3
The operations can be chained repeatedly, and maybe just needs to run one of the rules.

Let's see an example:

Convert 1 (base number) to 10 (target number) = 6 operations:

`1 * 2 * 2 * 2 * 2 // 3 * 2 = 10`

Convert 1 (base number) to 8 (target number) = 3 operations:

`1 * 2 * 2 * 2 = 8`

After some manual testing with a few small numbers, it seems to be working just fine.

But what about bigger numbers? What if the number is greater than 10?

Can you help him to design a function to mearsure the efficiency, aka, how many operations it will take to convert 1 (the base) to the asking target number?

[Hint] the data structure is the key here.

Metrics »

60 out of 64 users completed this Bite.

Will you be Pythonista #61 to crack this Bite?

Resolution time: ~105 min. (avg. submissions of 5-240 min.)

Pythonistas rate this Bite 8.22 on a 1-10 difficulty scale.

» Up for a challenge? 💪