title: Sum Matrix Element Absolute Difference Row Column Numbers 2
signature: class Solution {
  
      public Integer sumMatrixElementAbsoluteDifferenceRowColumnNumbers2(Integer n) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(12, 572);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(89, 234960);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(76, 146300);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(2, 2);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(81, 177120);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(11, 440);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(26, 5850);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(35, 14280);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(16, 1360);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(66, 95810);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def sum_matrix_element_absolute_difference_row_column_numbers_2(n):
      n -= 1
      sum = 0
      sum += ((n * (n + 1)) / 2)
      sum += (((n * (n + 1)) * ((2 * n) + 1)) / 6)
      return int(sum)
source_cpp: int sum_matrix_element_absolute_difference_row_column_numbers_2(int n) {
    n --;
    int sum = 0;
    sum += ( n * ( n + 1 ) ) / 2;
    sum += ( n * ( n + 1 ) * ( 2 * n + 1 ) ) / 6;
    return sum;
  }