ghostmkg / programming-language

You write code in any programming language you want. And push the code.
47 stars 124 forks source link

Implement Finding Maximum area in a Histogram #226

Open Ansh-Vikalp opened 1 day ago

Ansh-Vikalp commented 1 day ago

Description:

Write a Java program to compute the maximum rectangular area in a histogram. Given an array where each element represents the height of bars in a histogram, the program should determine the largest possible rectangular area that can be formed using consecutive bars.

Test Cases:

Input: histogram = [6, 2, 5, 4, 5, 1, 6] Expected Output: 12

Input: histogram = [2, 1, 5, 6, 2, 3] Expected Output: 10

Constraints:

Histogram heights are non-negative integers

img GFG

Image taken from GFG

Ansh-Vikalp commented 1 day ago

Hey! @ghostmkg please accept my pull request #227 to solve this issue.