title: Count Frequency K Matrix Size N Matrixi J Ij
signature: func countFrequencyKMatrixSizeNMatrixiJIj(n int, k int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, k int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n, k),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(90, 
  	74, 73)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(86, 
  	36, 35)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(92, 
  	38, 37)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(72, 
  	71, 70)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(25, 
  	57, -6)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(11, 
  	53, -30)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(94, 
  	80, 79)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(91, 
  	75, 74)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(66, 
  	58, 57)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(34, 
  	88, -19)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
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 );
  }