摘要: 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef struct LinkNode 4 { 5 int data; 6 LinkNode* next; 7 }LinkNode; 8 LinkNode *InitList() //创建空 阅读全文
posted @ 2020-10-03 11:30 然终酒肆 阅读(429) 评论(0) 推荐(0)
摘要: 本质上字符串这种题都可以暴力穷举 但是还是要用更好的算法试试 我开始没有想到这是一道可以用动态规划解决的问题 1 class Solution { 2 public: 3 string longestPalindrome(string s) { 4 int n = s.size(); 5 vecto 阅读全文
posted @ 2020-10-03 10:53 然终酒肆 阅读(158) 评论(0) 推荐(0)
摘要: 并不是很难 因为完全可以暴力去做 也可以参照kmp 但是我要说的是 这种题也可以用很经典得到滑动窗口 1 class Solution { 2 public: 3 int lengthOfLongestSubstring(string s) { 4 // 哈希集合,记录每个字符是否出现过 5 uno 阅读全文
posted @ 2020-10-03 10:29 然终酒肆 阅读(185) 评论(0) 推荐(0)
摘要: 1 class Solution { 2 public: 3 int minimumOperations(string leaves) { 4 int n = leaves.size(); 5 vector<vector<int>> f(n, vector<int>(3)); 6 f[0][0] = 阅读全文
posted @ 2020-10-03 00:51 然终酒肆 阅读(170) 评论(0) 推荐(0)