title: Sequences Given Length Every Element Equal Twice Previous
signature: class Solution {
  
      public Integer sequencesGivenLengthEveryElementEqualTwicePrevious(Integer m, Integer n) {
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(38, 34, 0);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(39, 29, 0);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(24, 99, 0);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(90, 23, 0);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(44, 2, 484);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(49, 70, 0);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(58, 84, 0);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(97, 34, 0);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(99, 72, 0);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(19, 67, 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
source_py: def sequences_given_length_every_element_equal_twice_previous(m, n):
      if (m < n):
          return 0
      if (n == 0):
          return 1
      res = (sequences_given_length_every_element_equal_twice_previous((m - 1), n) + sequences_given_length_every_element_equal_twice_previous((m // 2), (n - 1)))
      return res
source_cpp: int sequences_given_length_every_element_equal_twice_previous(int m, int n) {
    if ( m < n ) return 0;
    if ( n == 0 ) return 1;
    return sequences_given_length_every_element_equal_twice_previous ( m - 1, n ) + sequences_given_length_every_element_equal_twice_previous ( m / 2, n - 1 );
  }