Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: ...
分类:
其他好文 时间:
2019-10-13 23:34:58
阅读次数:
112
1222 Path with Maximum Gold 可以攻击国王的皇后 问题描述 在一个 8x8 的棋盘上,放置着若干 和一个 。 在棋盘上的位置分布用整数坐标数组 表示, 的坐标用数组 表示。 的行棋规定是: 横、直、斜 都可以走,步数不受限制,但是,不能 越子行棋 。 请你返回可以直接攻击到 ...
分类:
其他好文 时间:
2019-10-13 17:14:50
阅读次数:
88
https://leetcode.com/problems/maximum-equal-frequency/ ...
分类:
其他好文 时间:
2019-10-13 12:47:58
阅读次数:
92
1219 Path with Maximum Gold 黄金矿工 问题描述 你要开发一座金矿,地质勘测学家已经探明了这座金矿中的资源分布,并用大小为 的网格 进行了标注。每个单元格中的整数就表示这一单元格中的黄金数量;如果该单元格是空的,那么就是 。 为了使收益最大化,矿工需要按以下规则来开采黄金: ...
分类:
其他好文 时间:
2019-10-12 20:21:30
阅读次数:
104
1218 Longest Arithmetic Subsequence of Given Difference 最长定差子序列 问题描述 给你一个整数数组 和一个整数 ,请你找出 中所有相邻元素之间的差等于给定 的等差子序列,并返回其中最长的等差子序列的长度。 示例 1: 输入 :arr = [1, ...
分类:
其他好文 时间:
2019-10-12 11:27:48
阅读次数:
112
设两个变量firstSmall和secondSmall,初始化都设置成Infinity。这样在遍历数组的时候可以找到第一小和第二小的数字。当遇到第三个数字小于Infinity但是大于前两者时,就找到了triplet。 注意所谓的subsequence可以是不连续的,如下testcase一样可以通过。 ...
分类:
其他好文 时间:
2019-10-09 09:31:42
阅读次数:
54
折半搜索 (meet in the middle) CF888E Maximum_Subsequence / reference: translation: solution: 考虑到dfs的效率很低很低而且mod数在1e9的范围,肯定要用一个stl的容器啊(set) 2的35次方会超时,考虑折半搜 ...
分类:
其他好文 时间:
2019-10-08 12:21:29
阅读次数:
96
问题描述: Given a 2D grid, each cell is either a wall 'W', an enemy 'E' or empty '0' (the number zero), return the maximum enemies you can kill using one ...
分类:
其他好文 时间:
2019-10-07 09:59:01
阅读次数:
103
1 typedef long long ll; 2 typedef pair<int,int> P; 3 #define _for(i,a,b) for(register int i = (a);i < b;i ++) 4 #define _rep(i,a,b) for(register int i... ...
分类:
其他好文 时间:
2019-10-06 15:10:43
阅读次数:
74
1 typedef long long ll; 2 typedef pair<int,int> P; 3 #define _for(i,a,b) for(register int i = (a);i < b;i ++) 4 #define _rep(i,a,b) for(register int i... ...
分类:
其他好文 时间:
2019-10-06 15:05:38
阅读次数:
69