title: Count Ofdifferent Ways Express N Sum 1 3 4
signature: function count_ofdifferent_ways_express_n_sum_1_3_4(n)
source_py: def count_ofdifferent_ways_express_n_sum_1_3_4(n):
      DP = [0 for i in range(0, (n + 1))]
      DP[0] = DP[1] = DP[2] = 1
      DP[3] = 2
      for i in range(4, (n + 1)):
          DP[i] = ((DP[(i - 1)] + DP[(i - 3)]) + DP[(i - 4)])
      return DP[n]
source_cpp: int count_ofdifferent_ways_express_n_sum_1_3_4(int n) {
    int DP [ n + 1 ];
    DP [ 0 ] = DP [ 1 ] = DP [ 2 ] = 1;
    DP [ 3 ] = 2;
    for ( int i = 4;
    i <= n;
    i ++ ) DP [ i ] = DP [ i - 1 ] + DP [ i - 3 ] + DP [ i - 4 ];
    return DP [ n ];
  }
question_info.test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return isCorrect(actual,expected)
  end
  
  function driver(n, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(n) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver(44, 821223649)
      print(string.format("TEST-0...%s",result))
  
      result = driver(9, 40)
      print(string.format("TEST-1...%s",result))
  
      result = driver(19, 4895)
      print(string.format("TEST-2...%s",result))
  
      result = driver(10, 64)
      print(string.format("TEST-3...%s",result))
  
      result = driver(78, 10472279279564025)
      print(string.format("TEST-4...%s",result))
  
      result = driver(70, 222915410843904)
      print(string.format("TEST-5...%s",result))
  
      result = driver(81, 44361286907595736)
      print(string.format("TEST-6...%s",result))
  
      result = driver(81, 44361286907595736)
      print(string.format("TEST-7...%s",result))
  
      result = driver(49, 9107509825)
      print(string.format("TEST-8...%s",result))
  
  end
  
  main()
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 821223649, "inputs": {"n": 44}}, {"idx": 1, "outputs": 40, "inputs": {"n": 9}}, {"idx": 2, "outputs": 4895, "inputs": {"n": 19}}, {"idx": 3, "outputs": 64, "inputs": {"n": 10}}, {"idx": 4, "outputs": 10472279279564025, "inputs": {"n": 78}}, {"idx": 5, "outputs": 222915410843904, "inputs": {"n": 70}}, {"idx": 6, "outputs": 44361286907595736, "inputs": {"n": 81}}, {"idx": 7, "outputs": 44361286907595736, "inputs": {"n": 81}}, {"idx": 8, "outputs": 9107509825, "inputs": {"n": 49}}]
question_info.extension: lua
question_info.entry_fn_name: count_ofdifferent_ways_express_n_sum_1_3_4
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8
question_info.commands: lua __FILENAME__