Ninja and His Meetings Problem Statement

Ninja has started a new startup with a single conference room available for meetings. Given an array/list MEETINGS of consecutive appointment requests, Ninja must decide which meetings to accept. Since he requires a 15-minute break between meetings, he cannot accept consecutive requests.

The task is to figure out the maximum total booked minutes possible in the conference room for all meetings.

Example:

Input:
MEETINGS = [30, 15, 60]
Output:
90
Explanation:

Assuming meetings start at 12:00. The first meeting lasts for 30 minutes, ending at 12:30. Ninja requires a 15-minute break, rendering the next 15-minute meeting unfeasible. After resting, he can attend the subsequent 60-minute meeting. Thus, total booked minutes are 30 + 60 = 90.

Constraints:

  • 1 <= T <= 102
  • 1 <= N <= 5 * 103
  • 0 <= MEETINGS[i] <= 105 and MEETINGS[i] is a multiple of 15
  • Time Limit: 1 second
Input Format
The first line contains an integer ‘T’, indicating the number of test cases. Each test case consists of two parts:
  1. An integer ‘N’ indicating the number of meetings.
  2. N space-separated integers representing the duration of each meeting.
Output Format
For each test case, return the maximum number of minutes scheduled for meetings. Each result should be printed on a new line.
Note:
You are not required to print anything; just implement the function to return the answer.
AnswerBot
4mo

Find the maximum total booked minutes possible in a conference room for all meetings with a 15-minute break between meetings.

  • Iterate through the list of meeting durations and calculate the maximum tot...read more

Help your peers!
Select
Add answer anonymously...

Top Software Developer Interview Questions Asked at MindTickle

Q. Design the Low-Level Design (LLD) for a Parking Lot.
Q. Smallest Subarray With K Distinct Elements Given an array A consisting of N inte...read more
Q. Trapping Rain Water II Problem Statement Given an M * N matrix where each cell's...read more
Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits