title: Sequences Given Length Every Element Equal Twice Previous 1
signature: fun sequencesGivenLengthEveryElementEqualTwicePrevious1(m: Int, n: Int): Int {
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.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(m: Int, n: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(m, n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(10, 4, 4)
      println("TEST-0...${result}")
      
      result = driver(5, 2, 6)
      println("TEST-1...${result}")
      
      result = driver(2, 8, 0)
      println("TEST-2...${result}")
      
      result = driver(83, 7, 330)
      println("TEST-3...${result}")
      
      result = driver(91, 0, 0)
      println("TEST-4...${result}")
      
      result = driver(18, 53, 0)
      println("TEST-5...${result}")
      
      result = driver(83, 41, 0)
      println("TEST-6...${result}")
      
      result = driver(98, 53, 0)
      println("TEST-7...${result}")
      
      result = driver(43, 37, 0)
      println("TEST-8...${result}")
      
      result = driver(31, 20, 0)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: sequencesGivenLengthEveryElementEqualTwicePrevious1
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn