static int findMinimumDeletion ( int l , int r , int dp [ ] [ ] , String s ) {
  if ( l > r ) {
    return 0 ;
  }
  if ( l == r ) {
    return 1 ;
  }
  if ( dp [ l ] [ r ] != - 1 ) {
    return dp [ l ] [ r ] ;
  }
  int res = 1 + findMinimumDeletion ( l + 1 , r , dp , s ) ;
  for ( int i = l + 1 ;
  i <= r ;
  ++ i ) {
    if ( s . charAt ( l ) == s . charAt ( i ) ) {
      res = Math . min ( res , findMinimumDeletion ( l + 1 , i - 1 , dp , s ) + findMinimumDeletion ( i , r , dp , s ) ) ;
    }
  }
  return dp [ l ] [ r ] = res ;
}

static int findMinimumDeletion ( int l , int r , int dp [ ] [ ] , String s ) { if ( l > r ) { return 0 ; } if ( l == r ) { return 1 ; } if ( dp [ l ] [ r ] != - 1 ) { return dp [ l ] [ r ] ; } int res = 1 + findMinimumDeletion ( l + 1 , r , dp , s ) ; for ( int i = l + 1 ; i <= r ; ++ i ) { if ( s . charAt ( l ) == s . charAt ( i ) ) { res = Math . min ( res , findMinimumDeletion ( l + 1 , i - 1 , dp , s ) + findMinimumDeletion ( i , r , dp , s ) ) ; } } return dp [ l ] [ r ] = res ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (type_identifier) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (return_statement (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (return_statement (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal)))) consequence: (block (return_statement (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (decimal_integer_literal) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (identifier)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier))) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier)))))))))))) (return_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (identifier)))))