x******u 发帖数: 17 | 1 public class Solution {
public int candy(int[] ratings) {
int num[] = new int[ratings.length];
for (int i = 0; i < ratings.length - 1; i++) {
if (ratings[i+1] > ratings[i]) num[i+1] = num[i] + 1;
}
for (int i = ratings.length - 1; i > 0; i--) {
if (ratings[i-1] > ratings[i]) num[i-1] = Math.max(num[i]+1, num
[i-1]);
}
int sum = 0;
for (int i = 0; i < num.length; i++)
sum += 1 +... 阅读全帖 |
|
l******e 发帖数: 54 | 2 20- 行 我的 right 是单调不回溯的 所以是 O(n) 时间,O(1) 空间也显然,程序也应
该显然
class Solution {
public:
int candy(vector& ratings) {
int sum = 0;
int left = -1, right = 1;
for (int i = 0; i < ratings.size(); ++i) {
if (i > 0 && ratings[i] <= ratings[i - 1]) {
left = i - 1;
}
right = max(right, i + 1);
while (right < ratings.size() && ratings[right] < ratings[right - 1]) {
++right;
}
sum += max(i - left, right - i);
}
return sum;
}
}; |
|
C*******a 发帖数: 448 | 3 candy,trapping water这样的,解法都挺巧妙,
但是看上去比较adhoc,能用general的理论去解释么。 |
|
C*7 发帖数: 234 | 4 随便说一个
第一步:遍历M×N,每个点随机产生一种candy,同时检查左边和上面不形成3连。
第二步:重新遍历,每个点跟左边和上边2个位置尝试交换,如果能形成3连,结束。如
果到最后不能形成,全部重新生成一遍。
整体复杂度O(MN),除非Q很大,重试概率会比较高。或者改善下第二步 |
|
f******e 发帖数: 582 | 5 I'd like to take my 4-year old son to as for candy in the surrounding
neighborhood this halloween evening. I never do this before.
So we just find out which house has decoration, and go to knock the door,
and say "trick or Treat". That is it, right?
Thanks. |
|
f******3 发帖数: 3139 | 6 【 以下文字转载自 Immigration 讨论区 】
发信人: brighttiger (hehehehe), 信区: Immigration
标 题: 万圣节发CANDY了
发信站: BBS 未名空间站 (Mon Oct 31 14:42:44 2011, 美东)
版务决定发100个包子,按回复顺序,最好提一些对本版的建议,版务一定APPRECIATE.
谢谢大家!!! |
|
A*****8 发帖数: 8590 | 7 I Told My Kids I Ate All Their Halloween Candy |
|
A**n 发帖数: 1703 | 8 我们这里有人给小袋装的prezels这样的零食,虽然也是
垃圾,好歹比糖好。每年要来的糖都要偷偷扔掉大半。
我觉得应该从自己做起在小区里倡导给non-candy的风气。
比如铅笔之类的。我看ebay上的silly bandz 480根才16
刀,买一大袋子每个小朋友给一根应该挺好的 |
|
R*********i 发帖数: 7643 | 9 How about 20 servings of fruits? Better than candies... |
|
w**a 发帖数: 2461 | 10 估计是感冒吃的candy, 现在换吃ricola. |
|
t****y 发帖数: 576 | 11 有没有大牛贡献些deal
手里没有多少candy coupon,倾向于在RA用5 off 20买 |
|
c**********n 发帖数: 13712 | 12 是不管candy原价多少,都能减2刀吗?然后多余的金额可以cover其他东西,和上次
free bodywash的coupon一样吗?
到店里用过的同学麻烦给说一下,谢谢 |
|
m********1 发帖数: 368 | 13 Several kinds of 4.4 oz Hershey's chocolate (and other similar brands) are
now 3 for $6 at my store, so I can pick any three (same or different) and
the third is free - $4.28 tax included here. Or you can just get some other
candy $2 or less for free. |
|
c********2 发帖数: 2773 | 14
可以. I bought 6 can of Azoniza tea, 50cents each and 99-cent candy. 减2刀. |
|
r*****h 发帖数: 505 | 15 第一页的4个算halloween candy么?
还有我在CVS没看见mm 的in store coupon呀? |
|
p*******e 发帖数: 986 | 16 Yes. check the first receipt
Candies, Spend 12 Get 5 EB
to learn how much more to spend. |
|
a**********n 发帖数: 720 | 17 买了6个$1.98的M&M candies,用了三张$1.5MFC和一张$0.50的CVS Q,出$5刀的ECB,6
包糖才$1.88,不错。
其实买6包$1.98的kitkat也会出$5ecb的,小朋友喜欢kitkat,没胖子我也觉得划算,
谢谢LZ |
|
c******a 发帖数: 209 | 18 The candy is on sale for 50 cents each. Buy 2 get $1 up reward. Limit 4. |
|
|
f***w 发帖数: 1745 | 20 问问是不是大家买这个candy都要交税的么?我们这食品都不交税,不知道为啥买这个
要交…… |
|
d********e 发帖数: 1334 | 21 https://www.facebook.com/CVS/app_243024652485836
Hurry on over to the CVS Facebook page, click on the “Unreal Free Gift”
tab, and fill out the form to score a coupon in your Inbox valid for a FREE
Unreal Candy item!
*Limited quantity; Coupons available while supplies last. Up to a $1.19
value. Offer valid in store only. Limit of one coupon per customer. Must be
age 18 or over. |
|
r******w 发帖数: 40 | 22 刚从Meijer 买菜回来,发现MeIijer 圣诞节的东西75% off. candy不到$1.00. 如果你
去买菜,顺便去看看. |
|
|
G********r 发帖数: 3161 | 24 没啥好买的,只买了两个大铁桶和两个Candy Jar,两件Baby Onesies给朋友。糖还是
50%。 |
|
D*****a 发帖数: 810 | 25 Rite Aid 免费的 Nature Made Vitamelts (starting 10/26) 和 便宜 的 Mars Candy
(Starting 10/12)
见二楼 |
|
m*****5 发帖数: 90 | 26 谢谢~
然后我有个问题,
第一个链接里nature made的胖子上标着available at walmart,请问这种胖子能在ra用
吗?谢谢~
Candy |
|
|
|
n*******1 发帖数: 1308 | 29 有维他命图吗?在店里只看到9。49的
Candy |
|
q**********O 发帖数: 571 | 30 werthers sale for $1.5 each this week, buy 10 to reach $15 get $5 ECB.
there is $1 coupon at the werthers original website. you can print 2 from 1
browser after registration. open as more browsers as you can!
the deal get even sweeter if you get $ off coupon and $1.5 off 4 pack or $10
candy. |
|
|
o******6 发帖数: 9458 | 32 买了10包werthers,10张1off mfc刷不过系统显示胖子过期了,和RA有丢那次的情况一
样,好在小二手动了,还用了一张2off12 candy,包子送上谢LZ。 |
|
a*****e 发帖数: 2194 | 33 $2 off any Candy purchase of $10 or more! Great Holiday Gifts!
thanks |
|
G****y 发帖数: 3537 | 34 Got $4 off 20 candy and used it today!
Patience got paid! |
|
h**z 发帖数: 2013 | 35 Toysrus has Christmas candy 75% off, this includes all Lindt truffle bags,
regular price $7.99. also some dinning gift card with 10% discount, like
Quiznos, Panera etc |
|
|
q**********O 发帖数: 571 | 37 Free 2 bags of nestle candies.
Safeway 2 for $5, submit receipt to get $5 virtual card
Program Terms:
1. Buy two (2) Nestlé® Confections Stand-Up Bags (8oz-12oz) in a
single transaction between 5/16/16 and 7/31/16.
2. Photo of receipt must show store name and address, date and time of
purchase, qualifying purchases and receipt total.
3. Each receipt can only be submitted once; one reward per receipt.
4. Limit two (2) valid submissions per consumer, email address or mobile
phone number. See ... 阅读全帖 |
|
|
N*****3 发帖数: 81 | 39 求Furla Candy Bon Bon Mini Crossbody bag, color ink, |
|
p*****d 发帖数: 560 | 40 【 以下文字转载自 Dreamer 讨论区 】
发信人: Dreamer (不要问我从哪里来), 信区: Dreamer
标 题: 师妹留下了半个candy bar
发信站: BBS 未名空间站 (Thu Feb 18 23:32:23 2010, 美东)
师妹是去年fall来我们实验室的
师妹很漂亮
168的身高,妩媚的容颜,白皙的皮肤,款款的肩膀,大大地乳房,典型的东北姑娘,
说一口很洋气的带东北口音的普通话
完全是我喜欢的类型,我喜欢她的每一寸肌肤,每一缕幽香,每一根毛发
根她讲话时,甚至她说话时候呼出的气,我都很陶醉
那是女儿家散发出来的兰花香
我本以为我这个30岁的老博士终于能解决个人问题了
我在组里也算独当一面,她刚来时候什么都不会,毕竟本科刚毕业的孩子
我老板很凶
我就手把手教她
开组会,老板对她的数据不满意,我就屡屡站出来替她圆场
周末我带她去买菜
后来她不需要我带了
我想约她看电影,她刚来时候说自己忙,老板凶,周末要做实验
后来我都教会她了,老板也渐渐不那么凶她了,她周末仍然“没有时间”
总之没出来跟我看过一次电影
后来看到她跟一个开宝马的男生一起吃饭
那个男的就是 |
|
H******i 发帖数: 4704 | 41 其实那块candy bar是我吃了一半不小心留到她桌子上的 |
|
e*****G 发帖数: 6239 | 42 电脑啊, youtube search: candy crush cheat engine
安猪也有修改器,但是要root麻烦 |
|
p****z 发帖数: 35 | 43 I am planning to visit some friends in other state and want to bring
something that is special from Florida, especially candy or cookie. Thank
you for sharing your information. |
|
|
O***n 发帖数: 13127 | 45 我一般这种麻烦的小candy都pass,要吃就吃霸王餐。
感恩节那个也没搞过,一般那天外面人太多了。 |
|
m********e 发帖数: 4403 | 46 德国村Leavenworth,很多人去过,猪肘也被批了又批,呵呵。我觉得热狗,咸肉,香
肠都还可口,德国啤酒也不错。
距离Leavenworth车程20分钟有个以Aplets与Cotlets闻名的小镇Cashmere。小镇上最热
闹的地方大概就是糖果车间了,每年有8万游客去参观水果软糖的生产制作过程。
Aplets & Cotlets Candy Kitchen Free Tour
参观时是不允许拍照的,会有工作人员讲解。具体开放时间请查询公司网站:
http://www.libertyorchards.com/tour
Liberty Orchards Co., Inc.
117 Mission Avenue
Cashmere, WA 98815
(509) 782-4088
幽静的小镇
水果软糖也算是华州特产了,网购要付邮费,可以去Fred Meyer或Safeway找找,我买
过。
我觉得味道不错,还山寨过,为了减少浪费,没舍得放核桃:) |
|
O********4 发帖数: 33 | 47 请问哪里可以买到 Costa Rica candy 或者 Chocolate?
多谢 多谢! |
|
h********u 发帖数: 626 | 48 sorry,I thought you mean "chocolate roca"candy...have no idea for Costa Rica
chocolate,maybe you can find some on Amazon? |
|
r**********n 发帖数: 3914 | 49 可爱皮的帖子太多, 上一个跟可爱皮没关系的. 在家有时间, 做了几个JIGS, I CALL
THEM: HOME MADE TUNA CANDY.
A picture before,
and a picture after (一面),
另一面 |
|
T***S 发帖数: 16 | 50 sandy candy
My best lure for crappie.
I began to use this lure since last summer. I caught at least 20 crappies
with it each time. |
|