Question bank › Prefix Sum
Dsa Prefix Sum Easy

The Quietest Library

An urban planner needs to build a library that spans exactly K contiguous blocks. Each block has a recorded 'noise level'. To ensure a quiet environment, the library should be placed where the total noise level of the K blocks is minimized. Find the starting block index of this optimal location. If multiple locations have the same minimum noise, return the smallest index. Input Format: - Line 1: Two integers N (total blocks) and K (library length). - Line 2: N integers representing the noise levels of each block. Output Format: - A single integer representing the 0-indexed starting position. Example: Input: 5 2 10 2 3 8 1 Output: 1

Key concepts

prefix_sumsliding_window

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 Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.