You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[Leetcode-2970](https://leetcode.com/problems/count-the-number-of-incremovable-subarrays-i/)| Count The Number Of Incremovable Subarrays I |[c++](./leetcode/2970.count-the-number-of-incremovable-subarrays-i.cpp), [python3](./leetcode/2970.count-the-number-of-incremovable-subarrays-i.py)| Enumeration | O\(N\)| O\(1\)| - |
260
261
|[Leetcode-3272](https://leetcode.com/problems/find-the-count-of-good-integers/)| Find The Count Of Good Integers |[c++](./leetcode/3272.find-the-count-of-good-integers.cpp), [python3](./leetcode/3272.find-the-count-of-good-integers.py)| Enumeration | O\(10\*\*\(N/2\)\* NlogN\)| O\(10\*\*\(N/2\)\)| - |
|[Leetcode-2302](https://leetcode.com/problems/count-subarrays-with-score-less-than-k/)| Count Subarrays With Score Less Than K |[c++](./leetcode/2302.count-subarrays-with-score-less-than-k.cpp), [python3](./leetcode/2302.count-subarrays-with-score-less-than-k.py)| Binary Search | O\(N\)| O\(1\)| - |
477
478
|[Leetcode-3261](https://leetcode.com/problems/count-substrings-that-satisfy-k-constraint-ii/)| Count Substrings That Satisfy K Constraint II |[c++](./leetcode/3261.count-substrings-that-satisfy-k-constraint-ii.cpp), [python3](./leetcode/3261.count-substrings-that-satisfy-k-constraint-ii.py)| Binary Search | O\(N \+ Q\)| O\(N\)| - |
478
479
|[Leetcode-2563](https://leetcode.com/problems/count-the-number-of-fair-pairs/)| Count The Number Of Fair Pairs |[c++](./leetcode/2563.count-the-number-of-fair-pairs.cpp), [python3](./leetcode/2563.count-the-number-of-fair-pairs.py)| Binary Search | O\(NlogN\)| O\(1\)| - |
480
+
|[Leetcode-2970](https://leetcode.com/problems/count-the-number-of-incremovable-subarrays-i/)| Count The Number Of Incremovable Subarrays I |[c++](./leetcode/2970.count-the-number-of-incremovable-subarrays-i.cpp), [python3](./leetcode/2970.count-the-number-of-incremovable-subarrays-i.py)| Binary Search | O\(N\)| O\(1\)| - |
481
+
|[Leetcode-2972](https://leetcode.com/problems/count-the-number-of-incremovable-subarrays-ii/)| Count The Number Of Incremovable Subarrays II |[c++](./leetcode/2972.count-the-number-of-incremovable-subarrays-ii.cpp), [python3](./leetcode/2972.count-the-number-of-incremovable-subarrays-ii.py)| Binary Search | O\(N\)| O\(1\)| - |
479
482
|[Leetcode-3048](https://leetcode.com/problems/earliest-second-to-mark-indices-i/)| Earliest Second To Mark Indices I |[c++](./leetcode/3048.earliest-second-to-mark-indices-i.cpp), [python3](./leetcode/3048.earliest-second-to-mark-indices-i.py)| Binary Search | O\(NlogN\)| O\(N\)| - |
480
483
|[Leetcode-1901](https://leetcode.com/problems/find-a-peak-element-ii/)| Find A Peak Element II |[c++](./leetcode/1901.find-a-peak-element-ii.cpp), [python3](./leetcode/1901.find-a-peak-element-ii.py)| Binary Search | O\(N \* logM\)| O\(1\)| - |
481
484
|[Leetcode-34](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/)| Find First And Last Position Of Element In Sorted Array |[c++](./leetcode/34.find-first-and-last-position-of-element-in-sorted-array.cpp), [python3](./leetcode/34.find-first-and-last-position-of-element-in-sorted-array.py)| Binary Search | O\(logN\)| O\(1\)| - |
|[Leetcode-1782](https://leetcode.com/problems/count-pairs-of-nodes/)| Count Pairs Of Nodes |[c++](./leetcode/1782.count-pairs-of-nodes.cpp), [python3](./leetcode/1782.count-pairs-of-nodes.py)| Two Pointers | O\(VlogV \+ E\)| O\(V \+ E\)| - |
898
901
|[Leetcode-2824](https://leetcode.com/problems/count-pairs-whose-sum-is-less-than-target/)| Count Pairs Whose Sum Is Less Than Target |[c++](./leetcode/2824.count-pairs-whose-sum-is-less-than-target.cpp), [python3](./leetcode/2824.count-pairs-whose-sum-is-less-than-target.py)| Two Pointers | O\(NlogN\)| O\(1\)| - |
899
902
|[Leetcode-2563](https://leetcode.com/problems/count-the-number-of-fair-pairs/)| Count The Number Of Fair Pairs |[c++](./leetcode/2563.count-the-number-of-fair-pairs.cpp), [python3](./leetcode/2563.count-the-number-of-fair-pairs.py)| Two Pointers | O\(NlogN\)| O\(1\)| - |
903
+
|[Leetcode-2970](https://leetcode.com/problems/count-the-number-of-incremovable-subarrays-i/)| Count The Number Of Incremovable Subarrays I |[c++](./leetcode/2970.count-the-number-of-incremovable-subarrays-i.cpp), [python3](./leetcode/2970.count-the-number-of-incremovable-subarrays-i.py)| Two Pointers | O\(N\)| O\(1\)| - |
904
+
|[Leetcode-2972](https://leetcode.com/problems/count-the-number-of-incremovable-subarrays-ii/)| Count The Number Of Incremovable Subarrays II |[c++](./leetcode/2972.count-the-number-of-incremovable-subarrays-ii.cpp), [python3](./leetcode/2972.count-the-number-of-incremovable-subarrays-ii.py)| Two Pointers | O\(N\)| O\(1\)| - |
900
905
|[Leetcode-295](https://leetcode.com/problems/find-median-from-data-stream/)| Find Median From Data Stream |[c++](./leetcode/295.find-median-from-data-stream.cpp), [python3](./leetcode/295.find-median-from-data-stream.py)| Two Pointers | O\(logN\)| O\(N\)| - |
901
906
|[Leetcode-287](https://leetcode.com/problems/find-the-duplicate-number/)| Find The Duplicate Number |[c++](./leetcode/287.find-the-duplicate-number.cpp), [python3](./leetcode/287.find-the-duplicate-number.py)| Two Pointers | O\(N\)| O\(1\)| - |
902
907
|[Leetcode-28](https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/)| Find The Index Of The First Occurrence In A String |[c++](./leetcode/28.find-the-index-of-the-first-occurrence-in-a-string.cpp), [python3](./leetcode/28.find-the-index-of-the-first-occurrence-in-a-string.py)| Two Pointers | O\(M \+ N\)| O\(N\)| - |
// Tag: Array, Two Pointers, Binary Search, Enumeration
2
+
// Time: O(N)
3
+
// Space: O(1)
4
+
// Ref: -
5
+
// Note: -
6
+
7
+
// You are given a 0-indexed array of positive integers nums.
8
+
// 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.
9
+
// Return the total number of incremovable subarrays of nums.
10
+
// Note that an empty array is considered strictly increasing.
11
+
// A subarray is a contiguous non-empty sequence of elements within an array.
12
+
//
13
+
// Example 1:
14
+
//
15
+
// Input: nums = [1,2,3,4]
16
+
// Output: 10
17
+
// Explanation: The 10 incremovable subarrays are: [1], [2], [3], [4], [1,2], [2,3], [3,4], [1,2,3], [2,3,4], and [1,2,3,4], because on removing any one of these subarrays nums becomes strictly increasing. Note that you cannot select an empty subarray.
18
+
//
19
+
// Example 2:
20
+
//
21
+
// Input: nums = [6,5,7,8]
22
+
// Output: 7
23
+
// Explanation: The 7 incremovable subarrays are: [5], [6], [5,7], [6,5], [5,7,8], [6,5,7] and [6,5,7,8].
24
+
// It can be shown that there are only 7 incremovable subarrays in nums.
25
+
//
26
+
// Example 3:
27
+
//
28
+
// Input: nums = [8,7,6,6]
29
+
// Output: 3
30
+
// Explanation: The 3 incremovable subarrays are: [8,7,6], [7,6,6], and [8,7,6,6]. Note that [8,7] is not an incremovable subarray because after removing [8,7] nums becomes [6,6], which is sorted in ascending order but not strictly increasing.
# Tag: Array, Two Pointers, Binary Search, Enumeration
2
+
# Time: O(N)
3
+
# Space: O(1)
4
+
# Ref: -
5
+
# Note: -
6
+
7
+
# You are given a 0-indexed array of positive integers nums.
8
+
# 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.
9
+
# Return the total number of incremovable subarrays of nums.
10
+
# Note that an empty array is considered strictly increasing.
11
+
# A subarray is a contiguous non-empty sequence of elements within an array.
12
+
#
13
+
# Example 1:
14
+
#
15
+
# Input: nums = [1,2,3,4]
16
+
# Output: 10
17
+
# Explanation: The 10 incremovable subarrays are: [1], [2], [3], [4], [1,2], [2,3], [3,4], [1,2,3], [2,3,4], and [1,2,3,4], because on removing any one of these subarrays nums becomes strictly increasing. Note that you cannot select an empty subarray.
18
+
#
19
+
# Example 2:
20
+
#
21
+
# Input: nums = [6,5,7,8]
22
+
# Output: 7
23
+
# Explanation: The 7 incremovable subarrays are: [5], [6], [5,7], [6,5], [5,7,8], [6,5,7] and [6,5,7,8].
24
+
# It can be shown that there are only 7 incremovable subarrays in nums.
25
+
#
26
+
# Example 3:
27
+
#
28
+
# Input: nums = [8,7,6,6]
29
+
# Output: 3
30
+
# Explanation: The 3 incremovable subarrays are: [8,7,6], [7,6,6], and [8,7,6,6]. Note that [8,7] is not an incremovable subarray because after removing [8,7] nums becomes [6,6], which is sorted in ascending order but not strictly increasing.
// You are given a 0-indexed array of positive integers nums.
8
+
// 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.
9
+
// Return the total number of incremovable subarrays of nums.
10
+
// Note that an empty array is considered strictly increasing.
11
+
// A subarray is a contiguous non-empty sequence of elements within an array.
12
+
//
13
+
// Example 1:
14
+
//
15
+
// Input: nums = [1,2,3,4]
16
+
// Output: 10
17
+
// Explanation: The 10 incremovable subarrays are: [1], [2], [3], [4], [1,2], [2,3], [3,4], [1,2,3], [2,3,4], and [1,2,3,4], because on removing any one of these subarrays nums becomes strictly increasing. Note that you cannot select an empty subarray.
18
+
//
19
+
// Example 2:
20
+
//
21
+
// Input: nums = [6,5,7,8]
22
+
// Output: 7
23
+
// Explanation: The 7 incremovable subarrays are: [5], [6], [5,7], [6,5], [5,7,8], [6,5,7] and [6,5,7,8].
24
+
// It can be shown that there are only 7 incremovable subarrays in nums.
25
+
//
26
+
// Example 3:
27
+
//
28
+
// Input: nums = [8,7,6,6]
29
+
// Output: 3
30
+
// Explanation: The 3 incremovable subarrays are: [8,7,6], [7,6,6], and [8,7,6,6]. Note that [8,7] is not an incremovable subarray because after removing [8,7] nums becomes [6,6], which is sorted in ascending order but not strictly increasing.
# You are given a 0-indexed array of positive integers nums.
8
+
# 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.
9
+
# Return the total number of incremovable subarrays of nums.
10
+
# Note that an empty array is considered strictly increasing.
11
+
# A subarray is a contiguous non-empty sequence of elements within an array.
12
+
#
13
+
# Example 1:
14
+
#
15
+
# Input: nums = [1,2,3,4]
16
+
# Output: 10
17
+
# Explanation: The 10 incremovable subarrays are: [1], [2], [3], [4], [1,2], [2,3], [3,4], [1,2,3], [2,3,4], and [1,2,3,4], because on removing any one of these subarrays nums becomes strictly increasing. Note that you cannot select an empty subarray.
18
+
#
19
+
# Example 2:
20
+
#
21
+
# Input: nums = [6,5,7,8]
22
+
# Output: 7
23
+
# Explanation: The 7 incremovable subarrays are: [5], [6], [5,7], [6,5], [5,7,8], [6,5,7] and [6,5,7,8].
24
+
# It can be shown that there are only 7 incremovable subarrays in nums.
25
+
#
26
+
# Example 3:
27
+
#
28
+
# Input: nums = [8,7,6,6]
29
+
# Output: 3
30
+
# Explanation: The 3 incremovable subarrays are: [8,7,6], [7,6,6], and [8,7,6,6]. Note that [8,7] is not an incremovable subarray because after removing [8,7] nums becomes [6,6], which is sorted in ascending order but not strictly increasing.
0 commit comments