/*** @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);};
一.USB HID设备简介
USB HID设备主要用于和计算机进行交互通信,典型的USB HID类设备包括USB键盘、USB鼠标、USB游戏手柄等等,这些都是日常生活中常见的设备。以USB接口的鼠标为例,打开计算机的“设备管理器”,可以在“鼠标和其他…
“Common rules: 1- If the repo is on github, the support/bug link is also on the github with issues”" label; 2- Could ask questions by email list;" 3rd party software support link Note gcc https://gcc.gnu.org openssh https://bugzilla.mindrot.o…