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
Coding & Algorithms
Software Engineer
Meta
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

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
max-heap
greedy scheduling
cooldown
counting argument
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. 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 Problems
Sample Answer
Requirements
  • Input: list of job types (for example ['A','A','A','B','B','B']) and cooldown n >= 0.
  • Each tick runs one job or idles.
  • Same-type jobs must be separated by at least n other 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...


Submit Your Answer
Markdown supported