Earliest Time Every Pixel Phone Finishes Flashing and Testing
Last updated: November 29, 2026
Quick Overview
A Pixel test lab has one flashing station, so phones are flashed one at a time, each for a known duration; after flashing, each phone runs its own automated test in parallel with known length. Return the earliest time every phone has finished its test.
0
0
0 solved
A Pixel test lab has one flashing station, so phones are flashed one at a time, each for a known duration; after flashing, each phone runs its own automated test in parallel with known length. Return the earliest time every phone has finished its test.
Device-lab scheduling maps cleanly onto a two-stage greedy that Google onsite interviewers like. They check that you sort by test duration descending and prove it with an adjacent swap argument, since sorting by flash time is a tempting wrong answer.
What the Interviewer Expects
- Separate the sequential resource (flashing) from the parallel stage (testing)
- Order phones by test duration descending
- Compute the finish time as max over phones of flash end plus test
- Prove optimality with an exchange argument
- O(n log n) time
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
- Two flashing stations instead of one.
- Tests share a limited pool of k test rigs.
- Each phone has a deadline; can all meet it?
- Phones arrive over time with release dates.
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: lists flash and test of length n with positive ints. The flash station runs one phone at a time without idle time needed. A phone's test starts right after its flash and runs independently....
High-Level Design
Total flashing time is fixed no matter the order, so the only choice is which phones run their tests late. Put the longest tests first so they overlap with the remaining flashing, and leave short test...