Find Maximum Rectangle in Bar Chart
Company: Palo Alto Networks
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Overview: 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.
Read the full Palo Alto Networks Software Engineer interview experience this question came from
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.
Hints
- Clarify edge cases before coding.
- Keep the return value deterministic.