text: Check if n is not in dp then only call the function so as to reduce no of recursive calls
code: if ( ! dp . ContainsKey ( n ) ) dp . Add ( n , 1 + Math . Min ( n % 2 + count ( n / 2 ) , n % 3 + count ( n / 3 ) ) ) ;