title: Sequences Given Length Every Element Equal Twice Previous 1
signature: class Solution {
  
      public Integer sequencesGivenLengthEveryElementEqualTwicePrevious1(Integer m, Integer n) {
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.extension: java
question_info.entry_fn_name: sequencesGivenLengthEveryElementEqualTwicePrevious1
question_info.entry_cls_name: Solution
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.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer m, Integer n, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(m, 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(10, 4, 4);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(5, 2, 6);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(2, 8, 0);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(83, 7, 330);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(91, 0, 0);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(18, 53, 0);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(83, 41, 0);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(98, 53, 0);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(43, 37, 0);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(31, 20, 0);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer m, Integer n, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(m, n),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__