title: Sum K Th Group Odd Positive Numbers
signature: class Solution {
  
      public Integer sumKThGroupOddPositiveNumbers(Integer k) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer k, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(k,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(91, 753571);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(52, 140608);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(78, 474552);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(51, 132651);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(65, 274625);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(39, 59319);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(42, 74088);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(12, 1728);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(56, 175616);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(98, 941192);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer k, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(k),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def sum_k_th_group_odd_positive_numbers(k):
      cur = int(((k * (k - 1)) + 1))
      sum = 0
      while k:
          sum += cur
          cur += 2
          k = (k - 1)
      return sum
source_cpp: int sum_k_th_group_odd_positive_numbers(int k) {
    int cur = ( k * ( k - 1 ) ) + 1;
    int sum = 0;
    while ( k -- ) {
      sum += cur;
      cur += 2;
    }
    return sum;
  }