- 博客(7)
- 收藏
- 关注
原创 Array Nesting
Array Nesting int arrayNesting(vector<int>& nums) { int start = 0; //每次的起始位置 int cnt = 0; //某次查找到的数组长度 int res = 0; //最大长度 if(nums.size() == 0) return 0; ...
2018-09-13 14:30:11 126
原创 Employee Importance
Employee Importance // Employee info class Employee { public: // It’s the unique ID of each node. // unique id of this employee int id; // the importance value of this employee ...
2018-09-13 10:46:56 170
原创 Single Number
Single Number int singleNumber(vector& nums) { int id = 0; int offset = 500000; int cnt[1000001]; //初始化 每个数字出现的次数是0 for(int i = 0; i < 1000001; i ++) { cnt[i] = ...
2018-09-12 10:59:57 128
原创 Distribute Candies
Distribute Candies int distributeCandies(vector& candies) { int cnt = 1; //初始有一种 int N = candies.size(); sort(candies.begin(), candies.end()); for(int i = 1; i < N; i ++...
2018-09-12 10:58:13 157
原创 Beautiful Arrangement II
Beautiful Arrangement II vector constructArray(int n, int k) { int i, j; vector<int> res; for(i = 1, j = n; i <= j;) { if(k > 1) { if(k % 2 == 1) { ...
2018-09-12 10:56:16 147
原创 Teemo Attacking
Teemo Attacking int findPoisonedDuration(vector<int>& timeSeries, int duration) { //依次判断并累加时长 int timeLen = 0; if(timeSeries.size() == 0) { timeLen = 0; retu...
2018-09-12 10:54:59 186
原创 Product of array except self
Product of array except self vector productExceptSelf(vector& nums) { int product = 1; //乘积从1 开始 int zero_product = 1; //除0元素外的乘积 int tmp; //存放output临时的值 vector<...
2018-09-12 10:51:21 209
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人