title: Sequences Given Length Every Element Equal Twice Previous 1
signature: function sequencesGivenLengthEveryElementEqualTwicePrevious1(m: number, n: number): number {
source_py: def sequences_given_length_every_element_equal_twice_previous_1(m, n):
      T = [[0 for i in range((n + 1))] for i in range((m + 1))]
      for i in range((m + 1)):
          for j in range((n + 1)):
              if ((i == 0) or (j == 0)):
                  T[i][j] = 0
              elif (i < j):
                  T[i][j] = 0
              elif (j == 1):
                  T[i][j] = i
              else:
                  T[i][j] = (T[(i - 1)][j] + T[(i // 2)][(j - 1)])
      return T[m][n]
source_cpp: int sequences_given_length_every_element_equal_twice_previous_1(int m, int n) {
    int T [ m + 1 ] [ n + 1 ];
    for ( int i = 0;
    i < m + 1;
    i ++ ) {
      for ( int j = 0;
      j < n + 1;
      j ++ ) {
        if ( i == 0 || j == 0 ) T [ i ] [ j ] = 0;
        else if ( i < j ) T [ i ] [ j ] = 0;
        else if ( j == 1 ) T [ i ] [ j ] = i;
        else T [ i ] [ j ] = T [ i - 1 ] [ j ] + T [ i / 2 ] [ j - 1 ];
      }
    }
    return T [ m ] [ n ];
  }
question_info.test_list: [{"idx": 0, "outputs": 4, "inputs": {"m": 10, "n": 4}}, {"idx": 1, "outputs": 6, "inputs": {"m": 5, "n": 2}}, {"idx": 2, "outputs": 0, "inputs": {"m": 2, "n": 8}}, {"idx": 3, "outputs": 330, "inputs": {"m": 83, "n": 7}}, {"idx": 4, "outputs": 0, "inputs": {"m": 91, "n": 0}}, {"idx": 5, "outputs": 0, "inputs": {"m": 18, "n": 53}}, {"idx": 6, "outputs": 0, "inputs": {"m": 83, "n": 41}}, {"idx": 7, "outputs": 0, "inputs": {"m": 98, "n": 53}}, {"idx": 8, "outputs": 0, "inputs": {"m": 43, "n": 37}}, {"idx": 9, "outputs": 0, "inputs": {"m": 31, "n": 20}}]
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 convertToString(actual) === convertToString(expected);
  }
  
  function driver(m: number, n: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(m, n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(10, 4, 4);
    console.log(`TEST-0...${result}`);
  
    result = driver(5, 2, 6);
    console.log(`TEST-1...${result}`);
  
    result = driver(2, 8, 0);
    console.log(`TEST-2...${result}`);
  
    result = driver(83, 7, 330);
    console.log(`TEST-3...${result}`);
  
    result = driver(91, 0, 0);
    console.log(`TEST-4...${result}`);
  
    result = driver(18, 53, 0);
    console.log(`TEST-5...${result}`);
  
    result = driver(83, 41, 0);
    console.log(`TEST-6...${result}`);
  
    result = driver(98, 53, 0);
    console.log(`TEST-7...${result}`);
  
    result = driver(43, 37, 0);
    console.log(`TEST-8...${result}`);
  
    result = driver(31, 20, 0);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: sequencesGivenLengthEveryElementEqualTwicePrevious1
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js