Why wrong ans for 3 test cases?
int e=0, s= 0 ;
for(int i=0;i<n;i++){
arr[i]=s.nextInt();
e+=arr[i];
s = Math.max(s, a[i]);
}
do not start s = 0
u cannot sort the array since continous segments of board need to be painted
s needs to be the max element of the array