Count strictly decreasing-by-1 subarrays of length at least 2

Given an integer array arr, count the number of contiguous subarrays that satisfy:

  • subarray length >= 2

  • for every valid index i inside the subarray (starting from the second element),

    `a...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: