上一页 1 2 3 4 5 6 7 ··· 28 下一页
摘要: 题目链接:https://leetcode-cn.com/problems/maximum-subarray/ 题目大意: 略。 分析: 略 代码如下: 1 class Solution { 2 public: 3 int maxSubArray(vector<int>& nums) { 4 int 阅读全文
posted @ 2019-09-16 17:06 梦樱羽 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.nowcoder.com/practice/edfe05a1d45c4ea89101d936cac32469?tpId=101&tqId=33089&tPage=1&rp=1&ru=/ta/programmer-code-interview-guide&qru=/t 阅读全文
posted @ 2019-09-16 16:44 梦樱羽 阅读(762) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.nowcoder.com/practice/3473e545d6924077a4f7cbc850408ade?tpId=101&tqId=33082&tPage=1&rp=1&ru=/ta/programmer-code-interview-guide&qru=/t 阅读全文
posted @ 2019-09-16 16:09 梦樱羽 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.nowcoder.com/practice/36fb0fd3c656480c92b569258a1223d5?tpId=101&tqId=33077&tPage=1&rp=1&ru=/ta/programmer-code-interview-guide&qru=/t 阅读全文
posted @ 2019-09-16 14:55 梦樱羽 阅读(284) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://atcoder.jp/contests/abc140/tasks/abc140_d 题目大意 有一对 N 个人, 用字符串 S 表示, S[i] 如果等于 'L' 说明这个人面朝左, 如果等于 'R' 说明这个人面朝右, 如果一个人朝向的方向有另一个人的后背, 这个人就提供 阅读全文
posted @ 2019-09-08 17:55 梦樱羽 阅读(354) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://atcoder.jp/contests/abc140/tasks/abc140_e 题目大意 给定一个 1~N 的排列 P. 定义$X_{L, R}$的值为$P_L, P_{L+1}, \ldots, P_R$中第二大的数的值. 求$\displaystyle \sum_{ 阅读全文
posted @ 2019-09-08 16:04 梦樱羽 阅读(465) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/majority-element-ii/ 题目大意: 略。 分析: k个一起删, 最后check一下即可. 代码如下: 1 #define foreach(i,c) for (__typeof(c.begin()) i = 阅读全文
posted @ 2019-09-06 17:04 梦樱羽 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/majority-element/ 题目大意: 略。 分析: 略. 代码如下: 1 class Solution { 2 public: 3 int majorityElement(vector<int>& nums) { 阅读全文
posted @ 2019-09-06 16:14 梦樱羽 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/shortest-unsorted-continuous-subarray/ 题目大意: 略. 分析: 如果排序区间为 [L, R], 那么 nums[L] 一定大于区间内的最小值,而 nums[R] 一定大于区间内的最大值 阅读全文
posted @ 2019-09-06 15:39 梦樱羽 阅读(347) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/kth-largest-element-in-an-array/ 题目大意: 变换一下题意就是求第 k 小。 分析1: 利用库函数 nth_element(a + l, a + k, a + r), 它会使 a 这个数组中区 阅读全文
posted @ 2019-09-05 16:22 梦樱羽 阅读(648) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 28 下一页
Live2D