1 public class Solution { 2 public int lengthOfLongestSubstringTwoDistinct(String s) { 3 int res = 0; 4 int [] map = new int[256]; 5 int walker = 0; 6 int runner = 0; 7 int count = 0; 8 while(runner < s.length()){ 9 if(map[s.charAt(runner++)]++ == 0){ 10 count...
1 <= A.length == A[0].length <= 100 -100 <= A[i][j] <= 100 解法: classSolution{public:intminFallingPathSum(vector<vector<int>>& A){intm = A.size();intn = A[0].size(); vector<int> cur = A[0]; vector<int> pre = A[0];for(inti =1; i < m; i++){if(n >1...
技术标签: leetcode html 算法 java直接过了,但很慢 class Solution { public: int minSteps(string s, string t) { unordered_map<char,int> map; for(int i = 0; i < t.length(); i++){ map[t[i]]++; } for(int i = 0; i < s.length(); i++){ if(map.find(s[i]) != map....
1347. Minimum Number of Steps to Make Two Strings Anagram** https://leetcode.com/problems/minimum-number-of-steps-to-make-two-strings-anagram/ 题目描述 Given two equal-size strings s and t. In one step you can chooseany characterof ...
"bcde" is the answer because it occurs before "bdde" which has the same length. "deb" is not a smaller window because the elements of T in the window must occur in order. Note: All the strings in the input will only contain lowercase letters. ...
package LeetCode_1658 /** * 1658. Minimum Operations to Reduce X to Zero * https://leetcode.com/problems/minimum-operations-to-reduce-x-to-zero/ * You
tank += -heapq.heappop(que) res +=1iftank <0:return-1heapq.heappush(que, -g) prev = preturnres 参考资料:https://leetcode.com/problems/minimum-number-of-refueling-stops/solution/ 日期 2019 年 4 月 3 日—— 好久不刷题了,越来越手生...