Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS

What is the area of the largest rectangle under the histogram [3, 1, 3, 2, 2]?

  1. A. 7
  2. B. 4
  3. C. 9
  4. D. 6

Correct answer: D. 6

Each bar extends left and right while neighbours are at least as tall; the maximum product is the bar of height 2 spanning three bars, giving 6.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic