Minimum steps to reduce N to 0 by given operations | Function to find the minimum number to steps to reduce N to 0 ; Base case ; Recursive Call to count the minimum steps needed ; Return the answer ; Given Number N ; Function Call
def minDays ( n ) : NEW_LINE INDENT if n < 1 : NEW_LINE INDENT return n NEW_LINE DEDENT cnt = 1 + min ( n % 2 + minDays ( n // 2 ) , n % 3 + minDays ( n // 3 ) ) NEW_LINE return cnt NEW_LINE DEDENT N = 6 NEW_LINE print ( str ( minDays ( N ) ) ) NEW_LINE