Histogram Question : Stack and Queues challanges

My submitted code can’t give wrong answers.
First visible test case is already passing, but your compiler fails all test cases.
I think you need to either find out an issue with my code, or change your content.

Here’s the code I submitted.

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] histArr = new int[n];
for(int i=0; i<n; i++) {
histArr[i] = sc.nextInt();
}
int maxArea = getMaxArea(n, histArr);
System.out.println(maxArea);
sc.close();
}

private static int getMaxArea(int n, int[] histArr) {
    int [] areaArr = new int[n];
    for(int i=0; i<n; i++) {
        areaArr[i] = histArr[i];
        int j=i-1;
        int k=i+1;

        while(j>=0 && histArr[j]>=histArr[i]) {
            areaArr[i] = areaArr[i] + histArr[i];
            j--;
        }

        while(k<n && histArr[k]>=histArr[i]) {
            areaArr[i] = areaArr[i] + histArr[i];
            k++;
        }
    }
    int maxVal = 0;
    for(int val : areaArr) {
        if (val > maxVal) {
            maxVal = val;
        }
    }
    return maxVal;
}

}

PS: 1st case gives correct answers, but that one fails too.

take into consideration the long constraints which are failing your code
u need to use long instead if int,the question and content are correct
you can see this