Java: Largest rectangle in histogram

Level : Intermediate
Mentor: Shailendra Chauhan
Type : GuidedLab
Points : 10
Duration : 00:25:00

Lab Details

Difficulty Level: HARD

Problem Statement:

You are given an array of integers A[], where each element A[i] represents the height of a bar in a histogram. The width of each bar is 1. The task is to return the area of the largest histogram.

Input:

N =6, heights[] = {5,6,4,3,7,5}

Output:

The maximum area is 18


Self-paced Membership
  • 22+ Video Courses
  • 800+ Hands-On Labs
  • 400+ Quick Notes
  • 55+ Skill Tests
  • 45+ Interview Q&A Courses
  • 10+ Real-world Projects
  • Career Coaching Sessions
  • Email Support
Upto 60% OFF
Know More
Still have some questions? Let's discuss.
CONTACT US
Accept cookies & close this