Venkatesh2112001's blog

By Venkatesh2112001, history, 10 months ago, In English

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

Full text and comments »

  • Vote: I like it
  • +7
  • Vote: I do not like it