public static int solution ( int [ ] [ ] grid , int N ) {
  for ( int i = 1 ;
  i >= 0 ;
  i -- ) {
    for ( int j = N - 1 ;
    j >= 0 ;
    j -- ) {
      int current = 0 ;
      if ( j + 1 < N ) {
        current = Math . max ( current , grid [ i ] [ j + 1 ] ) ;
      }
      if ( i + 1 < 2 ) {
        current = Math . max ( current , grid [ i + 1 ] [ j ] ) ;
      }
      grid [ i ] [ j ] += current ;
    }
  }
  return grid [ 0 ] [ 0 ] ;
}

public static int solution ( int [ ] [ ] grid , int N ) { for ( int i = 1 ; i >= 0 ; i -- ) { for ( int j = N - 1 ; j >= 0 ; j -- ) { int current = 0 ; if ( j + 1 < N ) { current = Math . max ( current , grid [ i ] [ j + 1 ] ) ; } if ( i + 1 < 2 ) { current = Math . max ( current , grid [ i + 1 ] [ j ] ) ; } grid [ i ] [ j ] += current ; } } return grid [ 0 ] [ 0 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (array_access array: (identifier) index: (identifier)) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (identifier)))))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (identifier))))))) (return_statement (array_access array: (array_access array: (identifier) index: (decimal_integer_literal)) index: (decimal_integer_literal)))))