Count Subarrays such that minimum of the end is greater than the maximum of all numbers in between
Difference between en1 and en2, changed 1 character(s)
For a given array A of size n, find the count of subarrays of size>=3, where the minimum of the elements at both the ends of subarray is greater than the maximum of all the numbers in between.↵

Formally, if the subarray starts at l and ends at r, then min(A[l], A[r]) > max(A[l+1], A[l+2],..., A[r-1]).↵

0<= n <=1e5↵
1<= A[i] <=1e9↵

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Venkatesh2112001 2025-07-08 19:22:37 1 Tiny change: 's of size>3, where t' -> 's of size>=3, where t'
en1 English Venkatesh2112001 2025-07-08 15:42:11 436 Initial revision (published)