dynamic_programming.minimum_steps_to_one ======================================== .. py:module:: dynamic_programming.minimum_steps_to_one .. autoapi-nested-parse:: YouTube Explanation: https://www.youtube.com/watch?v=f2xi3c1S95M Given an integer n, return the minimum steps from n to 1 AVAILABLE STEPS: * Decrement by 1 * if n is divisible by 2, divide by 2 * if n is divisible by 3, divide by 3 Example 1: n = 10 10 -> 9 -> 3 -> 1 Result: 3 steps Example 2: n = 15 15 -> 5 -> 4 -> 2 -> 1 Result: 4 steps Example 3: n = 6 6 -> 2 -> 1 Result: 2 step Attributes ---------- .. autoapisummary:: dynamic_programming.minimum_steps_to_one.__author__ Functions --------- .. autoapisummary:: dynamic_programming.minimum_steps_to_one.min_steps_to_one Module Contents --------------- .. py:function:: min_steps_to_one(number: int) -> int Minimum steps to 1 implemented using tabulation. >>> min_steps_to_one(10) 3 >>> min_steps_to_one(15) 4 >>> min_steps_to_one(6) 2 :param number: :return int: .. py:data:: __author__ :value: 'Alexander Joslin'