码迷,mamicode.com
首页 >  
搜索关键字:r语言中的 vector    ( 11651个结果
LeetCode 240. 搜索二维矩阵 II Search a 2D Matrix II (Medium)
来源:力扣(LeetCode) class Solution { public: bool searchMatrix(vector<vector<int>>& matrix, int target) { if (matrix.empty()) return false; int rows = mat ...
分类:其他好文   时间:2020-05-19 12:29:18    阅读次数:49
LeetCode 283. 移动零 Move Zeroes (Easy)
给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。 来源:力扣(LeetCode) class Solution { public: void moveZeroes(vector<int>& nums) { int index = 0; for (int ...
分类:移动开发   时间:2020-05-19 00:16:24    阅读次数:72
LeetCode 594. 最长和谐子序列 Longest Harmonious Subsequence (Easy)
和谐数组是指一个数组里元素的最大值和最小值之间的差别正好是1。 现在,给定一个整数数组,你需要在所有可能的子序列中找到最长的和谐子序列的长度。 来源:力扣(LeetCode) class Solution { public: int findLHS(vector<int>& nums) { unor ...
分类:其他好文   时间:2020-05-18 23:01:29    阅读次数:74
【JSOI2008】星球大战
题目链接 直接算每次破坏会拆开多少个连通块貌似不可做。考虑反着加边用并查集合并。 那么我们首先用$vector$存下每个点出边到的点的序列。注意:$m\in[1,2\times 10^5]$而$n\in [1,2\times m]$所以$n\in [1,4\times 10^5]$。 读入破坏的顺序 ...
分类:Web程序   时间:2020-05-18 22:42:30    阅读次数:79
152. 乘积最大子数组
class Solution { public: int maxProduct(vector<int>& nums) { int len = nums.size(), res = nums[0]; int prevMin = nums[0], prevMax = nums[0]; int temp1 ...
分类:编程语言   时间:2020-05-18 22:24:53    阅读次数:71
leetcode5.18
152.乘积最大数组 include using namespace std; include include class Solution { public: int maxProduct(vector& nums) { int len = nums.size(); vectorvmax; vec ...
分类:其他好文   时间:2020-05-18 14:09:30    阅读次数:62
arrayList和vector的区别
1. Vector & ArrayList1) Vector的方法都是同步的(Synchronized),是线程安全的(thread-safe),而ArrayList的方法不是,由于线程的同步必然要影响性能,因此,ArrayList的性能比Vector好。2) 当Vector或ArrayList中的 ...
分类:其他好文   时间:2020-05-18 00:52:59    阅读次数:72
lc 最长公共前缀
链接:https://leetcode-cn.com/explore/interview/card/bytedance/242/string/1014/ 代码: class Solution { public: string longestCommonPrefix(vector<string>& s ...
分类:其他好文   时间:2020-05-18 00:20:51    阅读次数:72
数列分块入门 9 & 蒲公英
https://www.luogu.com.cn/problem/P4168 https://loj.ac/problem/6285 区间众数查询。 解法一 莫队,但是蒲公英有加密操作。 解法二 分块。 离散化+块内二分。 将每一个数出现的位置塞进一个 vector,排序,在面对整块时选择一手二分。 ...
分类:其他好文   时间:2020-05-16 18:31:16    阅读次数:52
数列分块入门 3 题解
https://loj.ac/problem/6279 vector+块内二分。 修改时需要重构,查询时可以二分查出来。 不要忘记 add 标记! ...
分类:其他好文   时间:2020-05-16 15:13:10    阅读次数:55
11651条   上一页 1 ... 66 67 68 69 70 ... 1166 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!