leetcode之 Minimum Height Trees
2016-03-11 20:07
363 查看
题目:
Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return
0 instead.
For example, given the array
the subarray
解答:
很简单的两个指针就完事,时间比较紧张,以后一眼瞅出来怎么做的都不写代码了
Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return
0 instead.
For example, given the array
[2,3,1,2,4,3]and
s = 7,
the subarray
[4,3]has the minimal length under the problem constraint.
解答:
很简单的两个指针就完事,时间比较紧张,以后一眼瞅出来怎么做的都不写代码了
相关文章推荐
- 清除浮动的几种方法
- C#取得多段线中圆弧中点坐标
- PHP函数 ------ ctype_alnum
- online_judge_1523
- 实验0 了解和熟悉操作系统 --操作系统
- java.util.zip压缩打包文件总结二: ZIP解压技术
- 2016太原UI设计师讲通道的原理,修图必学
- elk之logstash安装与配置
- BestCoder Round #74 (div.2) T4 Toposort HDOJ 5638
- 了解和熟悉操作系统
- 了解和熟悉操作系统--操作系统
- CentOS7及之前版本下关闭IPv6
- hdu5365Shortest Path (floyd)
- 发布Java桌面程序
- git :设置 object-c 的忽略文件
- 发布Java桌面程序
- switch引发的错误 a label can only be part of a statement and a declaration is not a statement
- mysql的多个问题
- Linux系统下添加Sudoer
- 高性能Mysql主从架构的复制原理及配置详解