text: Check if n is not in dp then only call the function so as to reduce no of recursive calls
code: if ( ( dp . find ( n ) == dp . end ( ) ) ) dp [ n ] = 1 + min ( n % 2 + count ( n / 2 ) , n % 3 + count ( n / 3 ) ) ;