Children of the Candy CornTime Limit: 1000msMemory Limit: 65536KBThis problem will be judged onPKU. Original ID:308364-bit integer IO format:%lld Java...
分类:
其他好文 时间:
2014-09-07 23:39:25
阅读次数:
275
题目大概就是考察,如何找到山峰的峰值。从左到右扫一遍,再从右到左扫一遍,确定每个位置的峰值。 1 class Solution { 2 public: 3 int Max(int a,int b) 4 { 5 return a>b?a:b; 6 } 7 ...
分类:
其他好文 时间:
2014-09-06 00:58:22
阅读次数:
352
leetcode Candy 很好精巧回溯算法思想,锻炼思维。...
分类:
其他好文 时间:
2014-09-05 10:07:11
阅读次数:
182
There are N children standing in a line. Each child is assigned a rating value.
You are giving candies to these children subjected to the following requirements:
Each child must have at least on...
分类:
其他好文 时间:
2014-09-04 23:43:20
阅读次数:
184
三种解法:推荐第一种和最后一种,
方法一:遍历2次,时间复杂度:O(n),看见复杂度:o(n)
方法三:遍历一次,时间复杂度:o(n), 空间复杂大:o(1)
/* There are N children standing in a line. Each child is assigned a rating value.
You are giving candies to these c...
分类:
其他好文 时间:
2014-09-04 10:32:09
阅读次数:
200
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie
Candy
Total Accepted: 16494 Total
Submissions: 87468My Submissions
There are N children standing in a line. Each child is ...
分类:
其他好文 时间:
2014-08-29 02:54:17
阅读次数:
228
1 Candy题目:There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the follo...
分类:
其他好文 时间:
2014-08-28 16:08:29
阅读次数:
294
原题戳我There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following...
分类:
其他好文 时间:
2014-08-28 12:59:49
阅读次数:
254
原题戳我There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following...
分类:
其他好文 时间:
2014-08-25 22:46:14
阅读次数:
307
被第二个条件给坑了
You are giving candies to these children subjected to the following requirements:
Each child must have at least one candy.Children with a higher rating get more candies than their ne...
分类:
其他好文 时间:
2014-08-23 11:20:30
阅读次数:
173