/**
* @param {number} target
* @param {number[]} nums
* @return {number}
*/varminSubArrayLen=function(target, nums){const n = nums.length;let ans = n +1;let sum =0;// 子数组元素和let left =0;// 子数组左端点for(let right =0; right < n; right++){// 枚举子数组右端点
sum += nums[right];while(sum - nums[left]>= target){// 尽量缩小子数组长度
sum -= nums[left++];// 左端点右移}if(sum >= target){
ans = Math.min(ans, right - left +1);}}return ans <= n ? ans :0;};
水果成篮(leetcode094)
/**
* @param {number[]} fruits
* @return {number}
*/vartotalFruit=function(fruits){const n = fruits.length;const cnt =newMap();let left =0, ans =0;for(let right =0; right < n;++right){
cnt.set(fruits[right],(cnt.get(fruits[right])||0)+1);while(cnt.size >2){
cnt.set(fruits[left], cnt.get(fruits[left])-1);if(cnt.get(fruits[left])==0){
cnt.delete(fruits[left]);}++left;}
ans = Math.max(ans , right - left +1);}return ans;};
H最小覆盖子串(leetcode76)
/**
* @param {string} s
* @param {string} t
* @return {string}
*/varminWindow=function(s, t){let minLen = s.length +1;let start = s.length;let map ={};let missingType =0;for(const c of t){if(!map[c]){
missingType++;
map[c]=1;}else{
map[c]++;}}let l =0, r =0;for(; r < s.length; r++){let rightChar = s[r];if(map[rightChar]!==undefined) map[rightChar]--;if(map[rightChar]==0) missingType--;while(missingType ==0){if(r - l +1< minLen){
minLen = r - l +1;
start = l;}let leftChar = s[l];if(map[leftChar]!==undefined) map[leftChar]++;if(map[leftChar]>0) missingType++;
l++;}}if(start == s.length)return"";return s.substring(start, start + minLen);};
Python数据类型
1、字符串(str)
str3 """I miss you so much"""
print("str3 ", str3,type(str3))
str3 I miss you so much <class str>2、整数(int)
str1 55
print(&quo…
摘要: 本文将带你走进 Linux 驱动开发的世界,从设备驱动模型、内核模块开发基础开始,逐步深入 I2C、SPI、USB 等常用外设的驱动编写,结合实际案例,助你掌握 Linux 驱动开发技能。
关键词: Linux 驱动,设备驱动模型,内核模块,I2C,SPI,USB
一、Linux 设备驱动模型
Li…