原题地址如果不限交易次数,把所有递增序列差值求和即可。代码: 1 int maxProfit(vector &prices) { 2 if (prices.empty()) 3 return 0; 4 5 int profi...
分类:
其他好文 时间:
2015-01-30 16:54:46
阅读次数:
129
问题描述;
Implement wildcard pattern matching with support for
'?' and '*'.
'?' Matches any single character.
'*' Matches any sequence of characters (including the empty sequence).
The matching shou...
分类:
其他好文 时间:
2015-01-29 22:34:30
阅读次数:
130
Compare two version numbers version1 and version1.
If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.
You may assume that the version strings are non-empty and co...
分类:
其他好文 时间:
2015-01-29 19:36:35
阅读次数:
168
删除元素/内容如需删除元素和内容,一般可使用以下两个 jQuery 方法:remove() - 删除被选元素(及其子元素)empty() - 从被选元素中删除子元素jQuery remove() 方法jQuery remove() 方法删除被选元素及其子元素。实例$("#div1").remove(...
分类:
Web程序 时间:
2015-01-29 19:21:08
阅读次数:
163
uva 11520 Fill the Square
In this problem, you have to draw a square using uppercase English Alphabets.
To be more precise, you will be given a square grid with some empty blocks and other...
分类:
其他好文 时间:
2015-01-29 17:49:36
阅读次数:
152
Given an array of size n, find the majority element. The majority element is the element that appears more than ?
n/2 ? times.
You may assume that the array is non-empty and the majority element ...
分类:
其他好文 时间:
2015-01-29 16:05:16
阅读次数:
164
Total Accepted: 24574
Total Submissions: 90344
Determine if a Sudoku is valid, according to:
Sudoku Puzzles - The Rules.
The Sudoku board could be partially filled, where empty cells ...
分类:
其他好文 时间:
2015-01-29 14:44:06
阅读次数:
182
原题地址动态规划题,注意0导致的小陷阱。代码: 1 int numDecodings(string s) { 2 if (s.empty() || s[0] '9') return 0; 3 4 int sum = s[s.length() - 1...
分类:
其他好文 时间:
2015-01-29 14:00:55
阅读次数:
150
Problem D
FILL
There are three jugs with a volume of a, b and c liters. (a, b, and c are positive integers not greater than 200). The first and the second jug are initially empty, while the...
分类:
其他好文 时间:
2015-01-28 09:46:17
阅读次数:
275
1. logic:empty
logic:empty标签是用来判断是否为空的。如果为空,该标签体中嵌入的内容就会被处理。该标签用于以下情况:
当Java对象为null时
当String对象为""时
当java.util.Collection对象中的isEmpty()返回true时
当java.util.Map对象中的isEmpty()返回true时
下面的代码示例了logic...
分类:
其他好文 时间:
2015-01-28 09:43:05
阅读次数:
183