Midnight Maintenance Timer
Preview mode. Log in to edit, run, submit, and save progress.
Easy
Midnight Maintenance Timer
A server maintenance window ends at the next midnight. For each current time h:m in 24-hour format, compute how many minutes remain until midnight. If the current time is exactly 00:00, the next midnight is treated as one full day away. Input Format: The first line contains t, the number of test cases. Each test case contains h and m. Output Format: For each test case, print the number of minutes until the next midnight.
Examples
Example 1
Input:
1 23 55
Output:
5
Explanation: Only five minutes remain before 24:00.
Approach hint
Start with the simplest clear approach, explain the trade-off, then move toward the cleaner answer.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.
solution.cpp