title: Count Even Length Binary Sequences With Same Sum Of First And Second Half Bits 1
signature: class Solution {
  
      public Double countEvenLengthBinarySequencesWithSameSumOfFirstAndSecondHalfBits1(Integer n) {
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.extension: java
question_info.entry_fn_name: countEvenLengthBinarySequencesWithSameSumOfFirstAndSecondHalfBits1
question_info.entry_cls_name: Solution
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.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Double 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(25, 126410606437752.0);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(18, 9075135300.0);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(17, 2333606220.0);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(8, 12870.0);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(8, 12870.0);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Double expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n),expected);
      }
      
      public boolean validateSolution(Double actual, Double expected){
          return Math.abs(actual - expected) < 1e-09;
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4
question_info.commands: java __FILENAME__