Description link Solution 看到这种题,首先是两个数作差 然后我们把所有的差连起来,每个序列和每个序列中间加上一个极大值 然后求出来 \(sa\) 和 \(height\) 数组,并且把所 要求的就是在每 \(n\) 个串的 \(lcp\) (这里好像就可以直接$height ...
分类:
其他好文 时间:
2020-06-14 12:48:37
阅读次数:
65
class Solution {public: vector<int> dailyTemperatures(vector<int>& T) { int n=T.size(); vector<int> t(n); for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) ...
分类:
其他好文 时间:
2020-06-14 10:33:43
阅读次数:
56
面试题63. 股票的最大利润 class Solution { public: int maxProfit(vector<int>& prices) { if(prices.size()<=1) return 0; int ans=prices[0]; int ans1=0; for(int i=1 ...
分类:
其他好文 时间:
2020-06-13 23:27:12
阅读次数:
69
链接:https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number/ 代码 class Solution { private String letters[] = {" ", "", "abc", "def", "ghi ...
分类:
其他好文 时间:
2020-06-13 21:47:24
阅读次数:
71
链接:https://leetcode-cn.com/problems/4sum/ 代码 class Solution { public List<List<Integer>> fourSum(int[] nums, int target) { List<List<Integer>> ans = n ...
分类:
其他好文 时间:
2020-06-13 21:04:30
阅读次数:
53
链接:https://leetcode-cn.com/problems/valid-parentheses/ 代码 class Solution { public boolean isValid(String str) { Stack<Character> stk = new Stack<>(); ...
分类:
其他好文 时间:
2020-06-13 20:55:01
阅读次数:
60
Error: forwarding ports: error upgrading connection: unable to upgrade connection: pod does not exist 安装Helm客户端和服务端后, 执行helm version报错, Error: forward ...
分类:
Web程序 时间:
2020-06-13 19:32:16
阅读次数:
99
题目 编写一个函数,检查输入的链表是否是回文的。 示例 1: 输入: 1->2 输出: false 示例 2: 输入: 1->2->2->1 输出: true 思路 利用栈来逆序判断。 代码 时间复杂度:O(n) 空间复杂度:O(n) class Solution { public: bool is ...
分类:
其他好文 时间:
2020-06-13 19:26:40
阅读次数:
59
做多网络流之后来个期望水一发 Description link 有一个 $1 \sim n$ 的排列,会进行 \(m\) 次操作,操作为交换 \(a,b\)。每次操作都有 $50%$ 的概率进行。 求进行 \(m\) 次操作以后的期望逆序对个数。 \(n,m\le 1000\) Solution 首 ...
分类:
其他好文 时间:
2020-06-13 17:48:36
阅读次数:
90
#博主的 BiBi 时间 博主今天被踩爆了已经不想哔哔了。 #Solution 所以,这题是个打表题? 有一个结论: 若 \(n\) 为奇数,则在 \([1,n]\) 中有奇数个 $1$ 的数字个数为 \((n+1)/2\);若 \(n\) 为偶数,则 \([1,n-1]\) 中有偶数个 $1$ 的 ...
分类:
其他好文 时间:
2020-06-13 17:38:49
阅读次数:
83