Question bank › Greedy
Dsa Greedy Warm-up

Efficient Book Reading

You are on a quest to read books and want to maximize the number of unique books you can read within a limited time. Each book takes a different amount of time to read. Given an array of integers where each element represents the reading time for a book and an integer representing the total time available, determine the maximum number of unique books you can read. Input Format: - The first line contains an integer n, the number of books. - The second line contains n space-separated integers representing the reading times for each book. - The third line contains an integer t, the total available reading time. Output Format: - An integer representing the maximum number of books that can be read within the available time. Example: Input: 5 2 3 4 5 6 10 Output: 3

Key concepts

greedysortingarray

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.