title: Minimum Time To Finish Tasks Without Skipping Two Consecutive
signature: function minimum_time_to_finish_tasks_without_skipping_two_consecutive(arr, n)
source_py: def minimum_time_to_finish_tasks_without_skipping_two_consecutive(arr, n):
      if (n <= 0):
          return 0
      incl = arr[0]
      excl = 0
      for i in range(1, n):
          incl_new = (arr[i] + min(excl, incl))
          excl_new = incl
          incl = incl_new
          excl = excl_new
      return min(incl, excl)
source_cpp: int minimum_time_to_finish_tasks_without_skipping_two_consecutive(vector<int> arr, int n) {
    if ( n <= 0 ) return 0;
    int incl = arr [ 0 ];
    int excl = 0;
    for ( int i = 1;
    i < n;
    i ++ ) {
      int incl_new = arr [ i ] + min ( excl, incl );
      int excl_new = incl;
      incl = incl_new;
      excl = excl_new;
    }
    return min ( incl, excl );
  }
question_info.entry_fn_name: minimum_time_to_finish_tasks_without_skipping_two_consecutive
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(arr, n, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(arr, 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({5, 17, 25, 27, 29, 30, 34, 49, 72, 75, 90, 93, 93, 94}, 8, 93)
      print(string.format("TEST-0...%s",result))
  
      result = driver({-70, -32, 62, 0, -10, 92, -94, -86, 52, 6, -26, -92, -10, 70, -82, 28, 86, 58, 86, -58, 84, -80, -18, -92, -34, 6, 34, 36, 70, -50, -6, -54, 84, 22, 30, -96, -84, 72, 2, 26, -20, 4, 48, -98, 62, -28, -68}, 36, -834)
      print(string.format("TEST-1...%s",result))
  
      result = driver({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 21, 5)
      print(string.format("TEST-2...%s",result))
  
      result = driver({34, 40, 92, 35, 29, 26, 12, 66, 7, 28, 86, 4, 35, 79, 1, 48, 41, 47, 15, 75, 45, 6, 3, 94, 39, 50, 20, 8, 58, 51, 83, 44, 53, 76, 19, 84, 68, 54, 36, 53}, 29, 359)
      print(string.format("TEST-3...%s",result))
  
      result = driver({-98, -98, -92, -92, -88, -82, -74, -70, -68, -68, -64, -60, -52, -52, -42, -42, -38, -36, -36, -34, -26, -24, -22, -12, -2, -2, 4, 6, 44, 44, 48, 54, 62, 62, 64, 74, 78, 82, 86, 86, 90, 90, 94}, 36, -1152)
      print(string.format("TEST-4...%s",result))
  
      result = driver({1, 1, 0, 0, 1, 0, 0, 1, 1, 1}, 5, 1)
      print(string.format("TEST-5...%s",result))
  
      result = driver({9, 15, 19, 29, 30, 39, 40, 61}, 4, 28)
      print(string.format("TEST-6...%s",result))
  
      result = driver({92, 0, 46, 70, -60, -50, 58, -56, 8, -90, 84, 16, 40, -62, 50, 78, 26, -42, -40, 98, -52, 62, 16, -62, -76, -70, -60, 32, 4, -68, 52, -64, 70, 12, -10}, 21, -314)
      print(string.format("TEST-7...%s",result))
  
      result = driver({0, 0, 0, 1, 1, 1, 1}, 5, 1)
      print(string.format("TEST-8...%s",result))
  
      result = driver({32, 96, 63, 93, 53, 1, 22, 19, 50, 74, 6, 94, 81, 85, 4, 86, 88, 75, 94}, 18, 397)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.test_list: [{"idx": 0, "outputs": 93, "inputs": {"arr": [5, 17, 25, 27, 29, 30, 34, 49, 72, 75, 90, 93, 93, 94], "n": 8}}, {"idx": 1, "outputs": -834, "inputs": {"arr": [-70, -32, 62, 0, -10, 92, -94, -86, 52, 6, -26, -92, -10, 70, -82, 28, 86, 58, 86, -58, 84, -80, -18, -92, -34, 6, 34, 36, 70, -50, -6, -54, 84, 22, 30, -96, -84, 72, 2, 26, -20, 4, 48, -98, 62, -28, -68], "n": 36}}, {"idx": 2, "outputs": 5, "inputs": {"arr": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "n": 21}}, {"idx": 3, "outputs": 359, "inputs": {"arr": [34, 40, 92, 35, 29, 26, 12, 66, 7, 28, 86, 4, 35, 79, 1, 48, 41, 47, 15, 75, 45, 6, 3, 94, 39, 50, 20, 8, 58, 51, 83, 44, 53, 76, 19, 84, 68, 54, 36, 53], "n": 29}}, {"idx": 4, "outputs": -1152, "inputs": {"arr": [-98, -98, -92, -92, -88, -82, -74, -70, -68, -68, -64, -60, -52, -52, -42, -42, -38, -36, -36, -34, -26, -24, -22, -12, -2, -2, 4, 6, 44, 44, 48, 54, 62, 62, 64, 74, 78, 82, 86, 86, 90, 90, 94], "n": 36}}, {"idx": 5, "outputs": 1, "inputs": {"arr": [1, 1, 0, 0, 1, 0, 0, 1, 1, 1], "n": 5}}, {"idx": 6, "outputs": 28, "inputs": {"arr": [9, 15, 19, 29, 30, 39, 40, 61], "n": 4}}, {"idx": 7, "outputs": -314, "inputs": {"arr": [92, 0, 46, 70, -60, -50, 58, -56, 8, -90, 84, 16, 40, -62, 50, 78, 26, -42, -40, 98, -52, 62, 16, -62, -76, -70, -60, 32, 4, -68, 52, -64, 70, 12, -10], "n": 21}}, {"idx": 8, "outputs": 1, "inputs": {"arr": [0, 0, 0, 1, 1, 1, 1], "n": 5}}, {"idx": 9, "outputs": 397, "inputs": {"arr": [32, 96, 63, 93, 53, 1, 22, 19, 50, 74, 6, 94, 81, 85, 4, 86, 88, 75, 94], "n": 18}}]