Hold Back Texts That Would Land During Local Quiet Hours

Last updated: November 29, 2026

Quick Overview

Given subscribers with UTC offsets and a campaign send time in UTC, return who can be texted now (local time between 8:00 and 21:00) and, for everyone else, how many minutes to wait until their next local 8:00.

Attentive
Coding & Algorithms
Software Engineer
Attentive
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Given subscribers with UTC offsets and a campaign send time in UTC, return who can be texted now (local time between 8:00 and 21:00) and, for everyone else, how many minutes to wait until their next local 8:00.

Attentive sends SMS campaigns for brands whose subscribers span every US time zone and beyond, and texting outside permitted local hours is a compliance problem, not just a bad experience. A phone screen in this style checks clean modular time arithmetic and whether the candidate thinks about boundaries and half-hour offsets.

What the Interviewer Expects
  • Convert UTC to local minute-of-day with modular arithmetic
  • Treat the window as half-open [8:00, 21:00) and state that choice
  • Compute the wait to the next 8:00 correctly for both before-8 and after-21 cases
  • Handle non-hour offsets such as +5:30
  • Run in O(n) with no date library needed
Key Topics to Cover
Modular arithmetic
Time zones
Compliance rules
Scheduling
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
  • How would you handle daylight saving time when you only store an offset?
  • What if the subscriber's time zone is unknown and you only have an area code?
  • How would you batch deferred subscribers so the scheduler does not wake once per minute?
  • Some states have stricter windows. How does the function change?
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: a list of (subscriber_id, utc_offset_minutes) and send_utc_minute in 0..1439. Output: the ids that can be sent now, plus a map from each held-back id to the minutes until its next local 8...

High-Level Design

For each subscriber, local minute-of-day = (send + offset) mod 1440. Python's % always returns a non-negative result, so negative offsets work. Inside the window means send now. Otherwise the wait...


Submit Your Answer
Markdown supported

Related Questions