Dsa
Prefix Sum
Easy
Batch Quality Reject
In a factory, items are produced in a line. Each item i has a quality score. A batch of K contiguous items is 'Rejected' if the sum of its quality scores is less than a minimum standard S. Identify all starting indices (0-indexed) of rejected batches.
Input Format:
- Line 1: Three integers N (total items), K (batch size), and S (minimum score sum).
- Line 2: N integers representing the quality score of each item.
Output Format:
- A single line containing all starting indices of rejected batches, space-separated. If no batches are rejected, output an empty line.
Example:
Input:
5 2 10
5 4 6 3 8
Output:
0 2
Key concepts
prefix_sumquality_control
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