text: Minimum steps to reduce N to 0 by given operations | C # program for the above approach ; 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 ; Driver Code ; Given number N ; Function call
code: using System ; class GFG { static int minDays ( int n ) { if ( n < 1 ) return n ; int cnt = 1 + Math . Min ( n % 2 + minDays ( n / 2 ) , n % 3 + minDays ( n / 3 ) ) ; return cnt ; } public static void Main ( String [ ] args ) { int N = 6 ; Console . Write ( minDays ( N ) ) ; } }