![image.png](https://prod-files-secure.s3.us-west-2.amazonaws.com/c26cbd8c-4ae9-4ab6-b595-99bb653f9d83/390c8e47-2f90-4296-a01e-e932c2744acc/image.png)

- bahii honii we have “Count the Number of Incremovable Subarrays I”

—> bahiii honii we have 0-indexed array of postive intergers “nums” 

- A Subarray of “nums” is called “incremovable” if nums becomes strictly increasing on removing the subarray
- bahii ke exmple : 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 striclty increasing
- bahiii honii we need to return thr total number of “incremovable” subarrays of nums
- bahii awll 7aje “ an empty array is considered striclty increasing”

→ bahii the “subarray” is a contigous non-empty sequance of elements within an array 

![image.png](https://prod-files-secure.s3.us-west-2.amazonaws.com/c26cbd8c-4ae9-4ab6-b595-99bb653f9d83/eacace95-a526-497e-8130-1e8dbcf3ea94/image.png)

Q- what is the input output & format ?

- input : List[int]
- output : int

Q- can you go through an exmple ? 

nums=[1,2,3,4] 

bahii awll 7aje we need to check if all the subarray and how to removing them will work yes or non ? 

Q- let’s try to check the naive solution here ? 

a naive solution will be just generate all the possible subarray 

then remove them( vittualy ) and chekc if the remaining array is sorted okii yes or non ? 

generate for me all the subarray of this  [1,2,3,4]

Sure! Here are all the subarrays of the array `[1, 2, 3, 4]`:

1. `[1]`
2. `[2]`
3. `[3]`
4. `[4]`
5. `[1, 2]`
6. `[2, 3]`
7. `[3, 4]`
8. `[1, 2, 3]`
9. `[2, 3, 4]`
10. `[1, 2, 3, 4]`

These are all the possible contiguous subarrays of the given array.

next for each one remove the subarray form the orginal array and return it 

generete all the reaming arrr after removing the subarray from the last generated ones 

Certainly! Let's generate the remaining arrays after removing each subarray from the original array `[1, 2, 3, 4]`.

1. Removing `[1]`:
    - Remaining array: `[2, 3, 4]`
2. Removing `[2]`:
    - Remaining array: `[1, 3, 4]`
3. Removing `[3]`:
    - Remaining array: `[1, 2, 4]`
4. Removing `[4]`:
    - Remaining array: `[1, 2, 3]`
5. Removing `[1, 2]`:
    - Remaining array: `[3, 4]`
6. Removing `[2, 3]`:
    - Remaining array: `[1, 4]`
7. Removing `[3, 4]`:
    - Remaining array: `[1, 2]`
8. Removing `[1, 2, 3]`:
    - Remaining array: `[4]`
9. Removing `[2, 3, 4]`:
    - Remaining array: `[1]`
10. Removing `[1, 2, 3, 4]`:
    - Remaining array: `[]`

These are the remaining arrays after removing each subarray from the original array `[1, 2, 3, 4]`.

Q- as we can see all the remaining arrays are increasing in there element so we just need to keep a counter to track them okii 

Q- i think the intution is clear here but the challange is how to translate this mental model idea into an actual implementation 

Q- is the intuion in the right direction yes or non 

Q- what are the conrete challanges here ? 

—> one is how to efficently “scan” all the subarrays 

—> then how to to check or generate the remaining element in the array without the subarray 

Q- okii let’s try to build a mental model to tackle the first challange ? 

- the first one is to tackle the scaning of all the subarrays

one why given that they are a contigous block of element we need to use slide window technique right ? which redcuing the scaning form O(n**2) worse case scenario into O(n)  one 

- technically to implment this we need a kind to two pointer okii (l and r) that scan the whole array

Q- for exmple this pseudoCode ? 

```python
l=0
n=len(nums)
for r in range(n):
		current_sub_arr=nums[l:r]
		
```

Q- did my thinking process so far in the right direction yes or non ? 

Q- without given me the full solution oki