Data Structures & AlgorithmsModerateTCS NQT · Codeforces Div2 B
Among the windows of exactly 3 consecutive elements of [5, 2, 9, 1, 7, 3, 8, 4], what is the smallest window sum that is at least 15?
- A. 18
- B. 16
- C. 11
- D. 15
Correct answer: D. 15
Window sums are 16, 12, 17, 11, 18, 15; those ≥ 15 are 16, 17, 18 and 15, so the smallest is 15. Stopping at the first qualifying window gives 16, the largest sum is 18, and 11 is the smallest sum overall, below the threshold.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- How many triples (a, b, c) with a < b < c taken from the set [1, 2, 3, 4, 5, 6, 8, 10, 12] satisfy a + b = c?
- How many strings of length 5 over the alphabet {a, b, c} do NOT contain the substring "abc"?
- A 2 × 5 grid has obstacles at (row, column) positions [(0, 2), (1, 3)] (rows 0 and 1, columns 0 to 4). Starting at (0,0), you move one…
- What is the length of the longest contiguous subarray of [4, 2, 2, 6, 4] whose bitwise XOR equals 6?
- Closed integer intervals are [(1, 2), (3, 4), (2, 5), (6, 7), (8, 9)]. How many unordered pairs of these intervals are disjoint (share no…
- How many ordered ways are there to write 8 as a sum of parts, each part being 1, 2 or 3 (the order of parts matters)?