1. Transition from dp [ i - 1 , 1 ] by just doing 1 extra operation of adding 2 ^ ( i + 1 ) 2. Transition from dp [ i - 1 , 0 ] by just doing 1 extra operation of adding 2 ^ i
dp [ i , 0 ] = 1 + Math . Min ( dp [ i - 1 , 0 ] , dp [ i - 1 , 1 ] ) ; } } return dp [ n - 1 , 0 ] ; } static String reverse ( String input ) { char [ ] temparray = input . ToCharArray ( ) ; int left , right = 0 ; right = temparray . Length - 1 ; for ( left = 0 ; left < right ; left ++ , right -- ) {