Posts

Showing posts from April, 2024

Leetcode question 1431 Kids With the Greatest Number of Candies

 This is a record on how I solved leetcode question 1431 kids with the greatest number of candies. The goal is output a List that contains if the specific kid is going to get the greatest number of candies. The term greatest here is defined as the maximum number of candies any kid has before adding the extra candies.  So, first is to get the "greatest" value, via a loop, or using Collections.max() but I never got it working. Then use another loop to append to the List variable.  Here's the code: class Solution { public List < Boolean > kidsWithCandies ( int [] candies , int extraCandies ) { List < Boolean > high = new ArrayList <>(); // find the kid with the most candy raw int max = candies[ 0 ]; for ( int i = 1 ; i < candies . length ; i++){ max = Math . max (candies[i], max); } for ( int i : candies){ if (i + extraCandies >= max) high . add ( true ); ...

圣路易斯摩托车路试

这篇文章是接上回,摩托车笔试之后的路试环节。 其实路试去年的时候就考取了,但是去考试需要自己带车,而前段时间没有车可以借,所以也就没考。今年三月份在fb marketplace上买了两二手山叶的50仔,最近两天去dmv缴税上车牌之后终于可以开始预约考试了。 预约考试还是在mshp网站上(是个square的网站),摩托车考试相对汽车比较难约,而且看天气状况。笔者还是推荐Koch road的这个考试场地,虽然离学校有些距离(骑车过去半个小时),但是场地是很好的,考官也很好。 笔者约下午两点半的考试,其实依照当天人数可以提早一个小时或者两个小时去考试。本人11点出发,12点到达(车排量小,大排量的按照限速骑半个小时就能到),就去签到了。 签到需要拿好之前申请的permit,如果有汽车(class f)驾照的话也记得给一下。之后考官会让你坐在外面等待。考官会出来,你们一起去考试。 摩托车考试同汽车不同,没有车辆检查。只要摩托车有车牌且sticker未过期即可。 考试是封闭场地,有四个到五个maneuver需要做,分别是: left turn smooth stop cone weave and right turn smooth stop quick stop quick swerve 考官在每个动作开始之前都会向你仔细讲解细则,不必担心,有问题也可以多问。用50仔考这种考试非常简单,本人一次性满分通过,当然用大一点的车也是完全ok的。 注意:cone weave的两个雪糕筒之前位置同一般泊位差不多,可以在空泊车场练习。 注意2:考试需要自己带车,而且考官不会问你车子是怎么过来的,自己骑过来或者让朋友骑过来也好。 注意3:考试结束后发成绩单,如果是满分,score一栏则会写0,是正常现象。