2025年3月4日
摘要: 左括号在n之前可以随意输出,右括号只有比左括号少才可以输出。 1 class Solution { 2 public: 3 vector<string> res; 4 void backTravel(int n, int left, int right, string s) { 5 if (left 阅读全文
posted @ 2025-03-04 20:58 Coder何 阅读(23) 评论(0) 推荐(0)
摘要: 1 class Solution { 2 public: 3 int lengthOfLongestSubstring(string s) { 4 int left = 0, right = 0; 5 int start = 0, len = 0; 6 int repeat = 0; //记录重复元 阅读全文
posted @ 2025-03-04 19:06 Coder何 阅读(8) 评论(0) 推荐(0)
摘要: 常规的滑动窗口问题,要注意满足答案的条件:1.窗口长度与p字符串长度一致2.字符充足的个数与p中不重复个数相同 1 class Solution { 2 public: 3 vector<int> findAnagrams(string s, string p) { 4 vector<int> re 阅读全文
posted @ 2025-03-04 19:05 Coder何 阅读(14) 评论(0) 推荐(0)