题目:Player A is playing Pingpong match with Player B. They take turns to serve 2 balls and who get to 11 points first win the game. When A is serving, A has the chance of pA to score. When B is serving, B has the chance of pB to score. What is the possibility of A winning the game, if A serves first?
说白了就是实现这个函数 double getProb(d ouble pA, double pB)
跑了test case
最后留了五分钟问问题。
我是用2维dp写的。
A, B兩人 play ping-pong, A 得分的機率是Pa, B得分的機率是Pb。每次贏球可得1分,先獲得11分的人獲勝。A 先serve 兩球後換B, B serve 兩球後換A,以此類推,請問A 獲勝的機率是多少?
要写了一个testcase, 他说我不要你hardcode… .我心一凉, 这说啥? 讲我要怎么写他花了3分钟解释,我还是不懂…之后就直接说"That is ok, lets move on"开了几个testcase 全pass…直接说好吧.让你有什么问题吗. 我每问一个问题, “How do you like to work at xxx”, “what is biggest challenge”, “what contriduction do you expect for this position within first 3 month, half year and year” 问了10多个问题每个问题不是一句话就是两句…搞到最后1小时只花了30分钟…隔天直接收到拒信…印度小哥真不是盖的. 有他们真的都找不到活了
We want to measure a metric called User Active Minutes (UAM). User active minutes for a given user is defined as the count of the number of distinct minutes in which the user takes some action on Twitter. Multiple actions in the same minute are only counted as one minute. We would like a histogram of the number of users who spend X minutes on Twitter, for different
values of X, given 30 days of raw logs and an interval size in minutes.
The raw logs are in the format: [user_id, epoch timestamp]. Each row represents an action a user took on Twitter. The logs are ordered chronologically. Duplicates are possible.
Write code to compute the histogram of UAMs across our user base.
Example:
Raw logs
[1, 1518290973]
[2, 1518291032]
[3, 1518291095]
[1, 1518291096]
[4, 1518291120]
[3, 1518291178]
[1, 1518291200]
[1, 1518291200]
Interval size
2
Resulting histogram
[2 , 2]
2 users spend 0 - 1 minutes on Twitter
2 users spend 2 - 3 minutes on Twitter
是按照bucket sort做的
interval=2的意思是取两个一分钟统计是,如果等于三 應該是0-2 3-5 6-8
力叩772 - Basic Calculator III https://leetcode.com/problems/basic-calculator-iii/
Implement a basic calculator to evaluate a simple expression string.
The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integers and empty spaces.
The expression string contains only non-negative integers, +, -, *, / operators , open ( and closing parentheses ) and empty spaces . The integer division should truncate toward zero.
You may assume that the given expression is always valid. All intermediate results will be in the range of [-2147483648, 2147483647].
Some examples:
店面当天一共一个小时,用的CodePair,简单寒暄两句之后直接开始一道是Binary Tree,说如果你站在树根右侧往上看,求看到的Node之和,理解下来就是求右侧子树的Node之和
另一道是给一个int array,shift left k element https://leetcode.com/problems/rotate-array/
最后还留了几分钟Q&A。整个过程还比较顺利,上午面的,下午Recruiter就通知Pass了