NO test cases are passing

long maxArea = 0;
int top;
long topArea;
int i = 0;
while (i < n) {
if (stack.isEmpty() || arr[stack.top()] <= arr[i]) {
stack.push(i++);

		} else {
			top = stack.top();
			stack.pop();
			topArea = arr[top] * (stack.isEmpty() ? i : i - stack.top() - 1);
			if (maxArea < topArea)
				maxArea = topArea;
		}
	}
	while (stack.isEmpty() == false) {
		top = stack.top();
		stack.pop();
		topArea = arr[top] * (stack.isEmpty() ? i : i - stack.top() - 1);
		if (maxArea < topArea)
			maxArea = topArea;
	}
	return maxArea;

@Vipin_coder,
https://ide.codingblocks.com/s/328739 corrected code.

Error:
Use long for input instead of int.

Note: I took this code from your last submission.

actually this is function problem ,input statement is by default in this solution.
so i was not change it .

@Vipin_coder,
I understand. Will update that