https://leetcode.cn/problems/TVdhkn/description/
```js
var subsets = function (nums) {
const ret = []
const dfs = (arr, index) => {
if(index==nums.length){
ret.push([...arr]);
return;
}
arr.push(nums);
dfs(arr, index + 1);
arr.pop();
dfs(arr, index + 1);
}
dfs([], 0)
return ret
};
```
https://leetcode.cn/problems/number-of-substrings-containing-all-three-characters/
过了
```js
var numberOfSubstrings = function (s) {
let left = 0;
let ans = 0;
const cnt = ;
for (let right = 0; right < s.length; right++) {
const char = s.charCodeAt() - 97;
cnt++;
while (cnt > 0 && cnt > 0 && cnt > 0) {
ans += s.length- right;
const leftChar = s.charCodeAt() - 97;
cnt--;
left++;
}
}
return ans;
};
```
https://leetcode.cn/problems/count-subarrays-where-max-element-appears-at-least-k-times/solutions/2560940/hua-dong-chuang-kou-fu-ti-dan-pythonjava-xvwg/
都没读懂题目我操
```js
var countSubarrays = function (nums, k) {
let max = Number.MIN_SAFE_INTEGER;
for (let index = 0; index < nums.length; index++) {
max = Math.max(max, nums);
}
let cnt = 0;
let left = 0;
let ans=0;
for (let index = 0; index < nums.length; index++) {
const num = nums;
if (num == max) {
cnt++;
}
while (cnt >= k) {
if (nums == max) {
cnt--;
}
left++;
}
ans+=left
}
return ans;
};
```
https://leetcode.cn/problems/count-substrings-with-k-frequency-characters-i/submissions/596796638/
过了
```js
var numberOfSubstrings = function (s, k) {
const cnt = new Array(26).fill(0);
let left = 0;
let ans=0;
for (let index = 0; index < s.length; index++) {
const char = s.charCodeAt() - 97;
cnt++;
if (cnt == k) {
while (cnt >= k) {
cnt.charCodeAt() - 97]--;
left++;
}
}
ans +=left;
}
return ans
};
```
https://leetcode.cn/problems/count-complete-subarrays-in-an-array/submissions/596797027/
过
```js
var countCompleteSubarrays = function (nums) {
const set = new Set();
for (const num of nums) {
set.add(num);
}
const maxSize = set.size;
let left = 0;
let map = new Map();
let ans = 0;
for (let index = 0; index < nums.length; index++) {
const num = nums;
map.set(num, (map.get(num) ?? 0) + 1);
while (map.size == maxSize) {
map.set(nums, map.get(nums) - 1);
if (map.get(nums) == 0) {
map.delete(nums);
}
left++;
}
ans += left;
}
return ans;
};
```
https://leetcode.cn/problems/count-the-number-of-good-subarrays/submissions/596797442/
凹过去了
```js
var countGood = function (nums, k) {
let left = 0;
let map = new Map();
let paris = 0;
let ans = 0;
for (let index = 0; index < nums.length; index++) {
const num = nums;
if (map.get(num) >= 1) {
paris += map.get(num);
}
map.set(num, (map.get(num) ?? 0) + 1);
while (paris>= k) {
const leftNum = nums;
map.set(leftNum, map.get(leftNum) - 1);
if (map.get(nums) > 0) {
paris-=map.get(nums);
}
left++;
}
ans += left;
}
return ans;
};
```
https://leetcode.cn/problems/subarray-product-less-than-k/submissions/596976603/
过了
```js
var numSubarrayProductLessThanK = function (nums, k) {
let left = 0;
let ans = 0;
let total = 1;
for (let index = 0; index < nums.length; index++) {
const num = nums;
total *= num;
while (total >= k && total !== 1) {
total = total / nums;
left++;
}
if (total <k) {
ans += index - left + 1;
}
}
return ans;
};
```
https://leetcode.cn/problems/count-substrings-that-satisfy-k-constraint-i/submissions/596979854/
过了
```js
var countKConstraintSubstrings = function (s, k) {
const times = ;
let left=0;
let ans=0;
for (let index = 0; index < s.length; index++) {
const pos = s.charCodeAt() - 48;
times++;
while(times>k&×>k){
const leftPos = s.charCodeAt() - 48;
times--;
}
ans+=index-left+1
}
return ans
};
```
https://leetcode.cn/problems/count-subarrays-with-score-less-than-k/submissions/596994229/
1800分题神经刀了
```js
var countSubarrays = function (nums, k) {
let left = 0;
let ans = 0;
let total = 0;
for (let index = 0; index < nums.length; index++) {
const num = nums;
total += num;
while (total * (index - left + 1) >= k) {
total = total - nums;
left++;
}
if (total * (index - left + 1) < k) {
ans += index - left + 1;
}
}
return ans;
};
```
https://leetcode.cn/problems/continuous-subarrays/submissions/597016958/
过了
```js
var continuousSubarrays = function (nums) {
let left = 0;
let ans = 0;
let list = new Map();
for (let index = 0; index < nums.length; index++) {
const num = nums;
list.set(num, (list.get(num) ?? 0) + 1);
while (true) {
let mx = num,
min = num;
for (const of list) {
mx = Math.max(key, mx);
min = Math.min(key, min);
}
if (mx - min <= 2) {
break;
}
const leftNum = nums;
list.set(leftNum, list.get(leftNum) - 1);
if (list.get(leftNum) == 0) {
list.delete(leftNum);
}
left++;
}
ans += index - left + 1;
}
return ans;
};
```