title: Maximum Number Segments Lengths B C
signature: function maximum_number_segments_lengths_b_c(n, a, b, c)
source_py: def maximum_number_segments_lengths_b_c(n, a, b, c):
      dp = ([(- 1)] * (n + 10))
      dp[0] = 0
      for i in range(0, n):
          if (dp[i] != (- 1)):
              if ((i + a) <= n):
                  dp[(i + a)] = max((dp[i] + 1), dp[(i + a)])
              if ((i + b) <= n):
                  dp[(i + b)] = max((dp[i] + 1), dp[(i + b)])
              if ((i + c) <= n):
                  dp[(i + c)] = max((dp[i] + 1), dp[(i + c)])
      return dp[n]
source_cpp: int maximum_number_segments_lengths_b_c(int n, int a, int b, int c) {
    int dp [ n + 1 ];
    memset ( dp, - 1, sizeof ( dp ) );
    dp [ 0 ] = 0;
    for ( int i = 0;
    i < n;
    i ++ ) {
      if ( dp [ i ] != - 1 ) {
        if ( i + a <= n ) dp [ i + a ] = max ( dp [ i ] + 1, dp [ i + a ] );
        if ( i + b <= n ) dp [ i + b ] = max ( dp [ i ] + 1, dp [ i + b ] );
        if ( i + c <= n ) dp [ i + c ] = max ( dp [ i ] + 1, dp [ i + c ] );
      }
    }
    return dp [ n ];
  }
question_info.entry_fn_name: maximum_number_segments_lengths_b_c
question_info.entry_cls_name: Solution
question_info.test_case_ids: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
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, a, b, c, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(n, a, b, c) 
      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(23, 16, 23, 18, 1)
      print(string.format("TEST-0...%s",result))
  
      result = driver(62, 76, 81, 97, -1)
      print(string.format("TEST-1...%s",result))
  
      result = driver(32, 46, 1, 78, 32)
      print(string.format("TEST-2...%s",result))
  
      result = driver(82, 48, 72, 58, -1)
      print(string.format("TEST-3...%s",result))
  
      result = driver(94, 99, 62, 38, -1)
      print(string.format("TEST-4...%s",result))
  
      result = driver(44, 21, 46, 60, -1)
      print(string.format("TEST-5...%s",result))
  
      result = driver(4, 57, 2, 77, 2)
      print(string.format("TEST-6...%s",result))
  
      result = driver(53, 23, 80, 5, 7)
      print(string.format("TEST-7...%s",result))
  
      result = driver(9, 55, 26, 85, -1)
      print(string.format("TEST-8...%s",result))
  
      result = driver(23, 15, 73, 42, -1)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.test_list: [{"idx": 0, "outputs": 1, "inputs": {"n": 23, "a": 16, "b": 23, "c": 18}}, {"idx": 1, "outputs": -1, "inputs": {"n": 62, "a": 76, "b": 81, "c": 97}}, {"idx": 2, "outputs": 32, "inputs": {"n": 32, "a": 46, "b": 1, "c": 78}}, {"idx": 3, "outputs": -1, "inputs": {"n": 82, "a": 48, "b": 72, "c": 58}}, {"idx": 4, "outputs": -1, "inputs": {"n": 94, "a": 99, "b": 62, "c": 38}}, {"idx": 5, "outputs": -1, "inputs": {"n": 44, "a": 21, "b": 46, "c": 60}}, {"idx": 6, "outputs": 2, "inputs": {"n": 4, "a": 57, "b": 2, "c": 77}}, {"idx": 7, "outputs": 7, "inputs": {"n": 53, "a": 23, "b": 80, "c": 5}}, {"idx": 8, "outputs": -1, "inputs": {"n": 9, "a": 55, "b": 26, "c": 85}}, {"idx": 9, "outputs": -1, "inputs": {"n": 23, "a": 15, "b": 73, "c": 42}}]