title: Count Even Length Binary Sequences With Same Sum Of First And Second Half Bits 1
signature: function countEvenLengthBinarySequencesWithSameSumOfFirstAndSecondHalfBits1(n: number): number {
source_py: def count_even_length_binary_sequences_with_same_sum_of_first_and_second_half_bits_1(n):
      nCr = 1
      res = 1
      for r in range(1, (n + 1)):
          nCr = ((nCr * ((n + 1) - r)) / r)
          res += (nCr * nCr)
      return res
source_cpp: int count_even_length_binary_sequences_with_same_sum_of_first_and_second_half_bits_1(int n) {
    int nCr = 1, res = 1;
    for ( int r = 1;
    r <= n;
    r ++ ) {
      nCr = ( nCr * ( n + 1 - r ) ) / r;
      res += nCr * nCr;
    }
    return res;
  }
question_info.test_list: [{"idx": 0, "outputs": 126410606437752.0, "inputs": {"n": 25}}, {"idx": 1, "outputs": 9075135300.0, "inputs": {"n": 18}}, {"idx": 2, "outputs": 2333606220.0, "inputs": {"n": 17}}, {"idx": 3, "outputs": 12870.0, "inputs": {"n": 8}}, {"idx": 4, "outputs": 12870.0, "inputs": {"n": 8}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return Math.abs(actual - expected) < 1e-09;
  }
  
  function driver(n: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(25, 126410606437752.0);
    console.log(`TEST-0...${result}`);
  
    result = driver(18, 9075135300.0);
    console.log(`TEST-1...${result}`);
  
    result = driver(17, 2333606220.0);
    console.log(`TEST-2...${result}`);
  
    result = driver(8, 12870.0);
    console.log(`TEST-3...${result}`);
  
    result = driver(8, 12870.0);
    console.log(`TEST-4...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: countEvenLengthBinarySequencesWithSameSumOfFirstAndSecondHalfBits1
question_info.test_case_ids: 0 1 2 3 4
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js