Tap here to switch tabs
Problem
Submissions

Problem: Count the Number of Incremovable Subarrays II

med
30 min
Try to solve the Count the Number of Incremovable Subarrays II problem.

Statement

You are given a 00 indexed array of positive integers nums.

A subarray is called incremovable if, after removing it, the remaining elements of nums are strictly increasing.

Return the total number of incremovable subarrays in nums.

Note: An empty remaining sequence is also considered strictly increasing. A subarray is a contiguous non empty sequence of elements within an array.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count the Number of Incremovable Subarrays II

med
30 min
Try to solve the Count the Number of Incremovable Subarrays II problem.

Statement

You are given a 00 indexed array of positive integers nums.

A subarray is called incremovable if, after removing it, the remaining elements of nums are strictly increasing.

Return the total number of incremovable subarrays in nums.

Note: An empty remaining sequence is also considered strictly increasing. A subarray is a contiguous non empty sequence of elements within an array.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9