2365.cpp (311B)
1 class Solution { 2 public: 3 long long taskSchedulerII(const vector<int> &tasks, int space) const { 4 unordered_map<int, long long> um; 5 long long day = 0; 6 7 for (const int t : tasks) { 8 um[t] = day = max(day, um[t] + space) + 1; 9 } 10 11 return day - space; 12 } 13 };