Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS
For windows of size 2 over [4, 2, 12, 11, 5] (using 5 in place of -5), what is the largest window minimum?
- A. 12
- B. 5
- C. 10
- D. 11
Correct answer: D. 11
Compute each window's minimum and take the largest; the pair (12, 11) gives minimum 11, which beats every other adjacent pair.
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
- For "abcdab", list the five length-2 substrings and hash each as (ord(first) + ord(second)) mod 11. How many index pairs i < j have equal…
- Arrivals at times 1, 2, 3, 5 and departures at 2, 4, 5, 6 (each arrival pairs with a departure; a train leaving at time t frees its…
- Take the XOR of a[i] XOR a[j] over all pairs i < j in [1, 2, 3, 4]. How many set bits (1-bits) does this combined XOR have?
- How many index triples i < j < k in [1, 2, 3, 4, 5, 6] satisfy a[i] + a[j] = a[k]?
- What is the smallest positive integer k such that k! is divisible by 2^10 = 1024?
- What is the length of the longest contiguous subarray of [2, 3, 1, 2, 4, 3] whose sum is exactly 7?