SOLUTION INFO
C++ · main.cpp
class Solution {
public:
int leastInterval(vector<char>& tasks, int n) {
vector<int> cnt(26);
for(char ch: tasks) ++cnt[ch-'A'];
sort(cnt.begin(), cnt.end());
int x = cnt.back() - 1;
int y = x * n;
for(int i = 24; i >= 0; --i) y -= min(x, cnt[i]);
return tasks.size() + max(0, y);
}
};
SOLUTION DESCRIPTION
풀이 설명
등록된 풀이 설명이 없습니다.