Minimum number of operations required to reduce N to 0 | C # Program to implement the above approach ; Function to find the minimum steps required to reduce n ; Base case ; Return answer based on parity of n ; Driver Code
using System ; class GFG { static int downToZero ( int n ) { if ( n <= 3 ) return n ; return n % 2 == 0 ? 3 : 4 ; } public static void Main ( String [ ] args ) { int n = 4 ; Console . WriteLine ( downToZero ( n ) ) ; } }