it does not show anything wether i have passed testcases or not .
code:->
#include
using namespace std;
int main(){
int n;
cin >> n;
int arr[n];
int l[10000];
int r[10000];
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
l[0] = arr[0];
r[n-1] = arr[n-1];
for (int i = 1; i < n; i++)
{
l[i] = max(l[i - 1], arr[i]);
}
for (int j = n - 2; j >=0;j--){
r[j] = max(r[j + 1], arr[j]) ;
}
int water = 0;
for (int i = 0; i < n;i++){
water = water + (min(l[i], r[i]) - arr[i]);
}
cout << water << endl;
return 0;
}