Interview Questions/Coding/Sprint Schedule Planner

Sprint Schedule Planner

Preview mode. Log in to edit, run, submit, and save progress.

Easy

Sprint Schedule Planner

An interview sprint contains n ordered tasks. Task i takes exactly 5*i minutes, where tasks are counted from 1. The day has 240 minutes total, but k minutes are already reserved for travel and setup. The candidate can only attempt an initial prefix of the task list. For each sprint, compute the maximum number of initial tasks that fit in the remaining time. Input Format: The first line contains t, the number of test cases. Each test case contains n and k. Output Format: For each test case, print the maximum number of tasks that can be completed.

Examples

Example 1
Input:
1
3 222
Output:
2

Explanation: Only 18 minutes remain. Tasks 1 and 2 take 5 + 10 = 15 minutes, while adding task 3 would require 30 minutes total.

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