Minimum number of operations required to reduce N to 0 | Function to find the minimum steps required to reduce n ; Base case ; Return answer based on parity of n ; Driver Code
function downToZero ( n ) { if ( n <= 3 ) return n ; return n % 2 == 0 ? 3 : 4 ; } let n = 4 ; document . write ( downToZero ( n ) ) ;