Algo - greedy Flashcards
1
Q
- Task Scheduler
e. g. tasks A,B,C,A,A. Distance between 2 “A” must be at least N
A
- calc freqs, minIndices e.g. minIndices[A] is the min idx that can put A
- create findBestTaskIdx: the one that satisfies minIndices and with maxFreq
- Similar problems:
a. 358. Rearrange String k Distance Apart
b. “1953. Maximum Number of Weeks for Which You Can Work” but with big number of tasks
c. “767. Reorganize String” with N = 1