Count the Number of Incremovable Subarrays I Problem
Count the Number of Incremovable Subarrays I Problem — ExecCode Easy DSA Practice
Solve the Count the Number of Incremovable Subarrays I problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given a 0-indexed array of positive integers nums. Your task is to compute the required answer and return the total number of incremovable subarrays of nums. A subarray of nums is called incremovable if nums becomes strictly increasing on removing the subarray. For example, the subarray [3, 4] is an incremovable subarray of [5, 3, 4, 6, 7] because removing this subarray changes the array [5, 3, 4, 6, 7] to [5, 6, 7] which is strictly increasing. Note that an empty array is considered strictly increasing. A subarray is a contiguous non-empty sequence of elements within an array.
Examples
Input {"nums": [1, 2, 3, 4]}; Output 10. Input {"nums": [6, 5, 7, 8]}; Output 7
Constraints
1 <= nums.length <= 50 1 <= nums[i] <= 50
Practice Count the Number of Incremovable Subarrays I free on ExecCode. Browse DSA problems, topic map, and placement guides.