Minimum Ticks to Run Notification Jobs With a Per-Type Cooldown
Last updated: November 29, 2026
Quick Overview
A notification worker runs one job per tick, and two jobs of the same type must be at least n ticks apart. Given the job types, return the minimum number of ticks (including idle ticks) to finish them all.
Meta
November 29, 20260
0
0 solved
A notification worker runs one job per tick, and two jobs of the same type must be at least n ticks apart. Given the job types, return the minimum number of ticks (including idle ticks) to finish them all.
Meta's notification pipeline rate-limits each notification type, which makes this scheduling question a natural technical-screen pick. Interviewers usually accept a heap simulation first and then ask whether you can derive the closed-form count.
What the Interviewer Expects
- Recognize that order matters only through frequencies
- Simulate with a max-heap plus a cooldown queue
- Derive the formula max(len, (maxFreq - 1) * (n + 1) + countOfMax)
- Explain why idle ticks appear only when one type dominates
- Cross-check the two methods
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Return the actual schedule, not just its length.
- What if the job order is fixed and you can only insert idles?
- How does this change if there are m workers?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Input: list of job types (for example
['A','A','A','B','B','B']) and cooldownn >= 0. - Each tick runs one job or idles.
- Same-type jobs must be separated by at least
nother ticks. - Output:...
High-Level Design
Simulation. Keep a max-heap of remaining counts. Each tick, pop the type with the most remaining work, run one job, and if it still has work put it in a FIFO with the tick it becomes eligible agai...