Apparently BFS is the most obvious one.. but it is not that simple - only constant extra space is provided.Then the only strategy to take is recursion...
分类:
其他好文 时间:
2014-07-22 00:39:35
阅读次数:
258
The trick is, we can work on a reversed vector - learnt from EPI.class Solution {public: vector plusOne(vector &digits) { std::reverse(digit...
分类:
其他好文 时间:
2014-07-22 00:33:36
阅读次数:
223
Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime comp...
分类:
其他好文 时间:
2014-07-22 00:28:38
阅读次数:
209
Agri-Net
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 38805
Accepted: 15674
Description
Farmer John has been elected mayor of his town! One of his campa...
分类:
其他好文 时间:
2014-07-21 14:12:34
阅读次数:
278
Agri-Net
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 38801
Accepted: 15671
Description
Farmer John has been elected mayor of his town! One of his campa...
分类:
Web程序 时间:
2014-07-21 11:42:34
阅读次数:
249
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at...
分类:
其他好文 时间:
2014-07-21 09:14:10
阅读次数:
168
1 live in 居住 2 dish 盘,菜肴 e.g. Surprise a new neighbour with one of your favourite home-made dishes! 3 put away 收好,储存 e.g. Her bed was crisply made收拾的很...
分类:
其他好文 时间:
2014-07-21 08:11:02
阅读次数:
222
Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity...
分类:
其他好文 时间:
2014-07-21 00:39:31
阅读次数:
249
Problem Description
Whuacmers use coins.They have coins of value A1,A2,A3...An Silverland dollar. One day Hibix opened purse and found there were some coins. He decided to buy a very nice watch in...
分类:
其他好文 时间:
2014-07-20 23:01:28
阅读次数:
271
//一般的字符串的解析 NSString *string = @"One,Two,Three,Four"; NSLog(@"string:%@",string); NSArray *array = [string componentsSeparatedByString:@","]; NSLo...
分类:
其他好文 时间:
2014-07-20 21:35:54
阅读次数:
200