title: Count Frequency K Matrix Size N Matrixi J Ij
signature: class Solution {
  
      public Integer countFrequencyKMatrixSizeNMatrixiJIj(Integer n, Integer k) {
source_py: def count_frequency_k_matrix_size_n_matrixi_j_ij(n, k):
      if ((n + 1) >= k):
          return (k - 1)
      else:
          return (((2 * n) + 1) - k)
source_cpp: int count_frequency_k_matrix_size_n_matrixi_j_ij(int n, int k) {
    if ( n + 1 >= k ) return ( k - 1 );
    else return ( 2 * n + 1 - k );
  }
question_info.extension: java
question_info.entry_fn_name: countFrequencyKMatrixSizeNMatrixiJIj
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 73, "inputs": {"n": 90, "k": 74}}, {"idx": 1, "outputs": 35, "inputs": {"n": 86, "k": 36}}, {"idx": 2, "outputs": 37, "inputs": {"n": 92, "k": 38}}, {"idx": 3, "outputs": 70, "inputs": {"n": 72, "k": 71}}, {"idx": 4, "outputs": -6, "inputs": {"n": 25, "k": 57}}, {"idx": 5, "outputs": -30, "inputs": {"n": 11, "k": 53}}, {"idx": 6, "outputs": 79, "inputs": {"n": 94, "k": 80}}, {"idx": 7, "outputs": 74, "inputs": {"n": 91, "k": 75}}, {"idx": 8, "outputs": 57, "inputs": {"n": 66, "k": 58}}, {"idx": 9, "outputs": -19, "inputs": {"n": 34, "k": 88}}]
question_info.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 k, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n, 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(90, 74, 73);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(86, 36, 35);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(92, 38, 37);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(72, 71, 70);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(25, 57, -6);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(11, 53, -30);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(94, 80, 79);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(91, 75, 74);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(66, 58, 57);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(34, 88, -19);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Integer k, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n, k),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: java __FILENAME__