Find Maximum Rectangle in Bar Chart
Company: Palo
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Quick Answer: This question evaluates algorithmic problem-solving and data structure proficiency in computing the maximum rectangular area within a histogram-like array, focusing on contiguous segment analysis and range-based aggregation.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([2,1,5,6,2,3],)
Expected Output: 10
Explanation: Best rectangle area is 10.
Input: ([2,4],)
Expected Output: 4
Explanation: Best area is 4.
Input: ([0],)
Expected Output: 0
Explanation: Zero height gives zero area.
Hints
- Clarify edge cases before coding.
- Keep the return value deterministic.