1. recordEvent(event, time, date)
2. getEventCount(event, start, end, granularity)

Input例如：

// recordEvent(“tweet”, 6am 2019-06-03) #event 名字不一定是"tweet"，可以是任何string
// recordEvent(“tweet”, 6:30am 2019-06-03)
// getEventCount(“tweet”, 6am 2019-06-01, 6:29am 2019-06-03, DAY) => [0,0,1] 表示2019-06-01没有event, 2019-06-02没有event, 2019-06-03有1个event
// getEventCount(“tweet”, 12am 2019-06-01, 12am 2019-06-03, DAY) => [0,0,1] 表示2019-06-01没有event, 2019-06-02没有event, 2019-06-03有1个event
// getEventCount(“tweet”, 6:00am 2016-06-01, 8:00am 2019-06-01, HOUR) => [2, 0] 表示2019-06-01 6点~7点内有2个event, 7点~8点内没有event
// getEventCount(“tweet”, 6am today, 8am today, MINUTE) => array of size 120 i.e. [1, 0, 0, …], [tweets between 6:00am and 6:01am, ]

``````enum GRANULARITY {
MINUTE, HOUR, DAY
}
``````

Background and project， 然后利口 403

A, B兩人 play ping-pong, A 得分的機率是Pa, B得分的機率是Pb。每次贏球可得1分，先獲得11分的人獲勝。A 先serve 兩球後換B, B serve 兩球後換A，以此類推，請問A 獲勝的機率是多少?

DP[a][b]等于A得a分同时B得b分的概率。这样算到最后ans = DP[11][0] + DP[11][1] + … + DP[11][10]。

“A 得分的機率是Pa, B得分的機率是Pb” 这个应该是谁先serve ball吧，否则 Pa + Pb = 1

nums = [1,2,3,4,5,6,7,8,9,10]
K = 4 => [4,3,2,1,8,7,6,5,10,9]

1. 该是刷题网站原题，一个数能被3整除，print"fizz",能被5整除，print“buzz”，技能被3又能被5整除，print“fizzbuzz”
2. 一个path，"/a/b/c/d/file.text" 返回文件名file，前提是input是valid的，另一个case是文件名"a\b\c\d.text" ,写code能处理这两种case
3.类似 里扣 伞玲思，不过更简单，已经给了cache，直接写出公式就好了，不过这个没时间写代码，给他解释了一下，最后的公式好像还有点问题。。
求过求过

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

interval=2的意思是取两个一分钟统计是，如果等于三 應該是0-2 3-5 6-8

Follower up:

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:

``````"1 + 1" = 2
" 6-4 / 2 " = 4
"2*(5+5*2)/3+(6/2+8)" = 21
"(2+6* 3+5- (3*14/7+2)*5)+3"=-12
``````

//06:01:43 Play 1
//06:02:43 Pause 1
//06:03:43 Play 1
//08:05:21 Play 2
//08:09:33 Pause 1
//12:33:21 Pause 2
//13:12:10 Play 3
//14:12:10 Pause 3
//00:00:00 Pause All

//06:01:43 Play 1
//06:02:43 Play 2
//06:03:43 Pause 1
//08:05:21 Pause 2

Edge Case，如果有个用户只点了Play，没有点Pause的话，那么log最后一行有个Pause All，会让当天所有没有Pause的用户暂定，并且记录时间
LZ当时给了merge interval的nlogn解法，被告知不是最优解。

``````import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {
public static void main(String[] args) {
}
enum Granularity {
MINUTE, HOUR, DAY
}

interface CountingService {
public void recordEvent(String eventType, long timeInMillis);

public long[] getEventCounts(Granularity granularity, String eventType, long startTime, long endTime);
}
}
``````

timeInMillis: UNIX time

granularity： 分解粒度
startTime：时间窗起点
endTime：时间窗末点，不一定比starttime大

Map套List套Map，Map<timeInMillis, List<Map<eventType, count>>>

Map套List，Map<timeInMillis, List>

Map套List，Map<eventType, List>

Map套Map，Map<eventType, Map<timeInMillis, count>>

1. recruiter电聊：聊了自己的背景，项目等等，比较随意。然后她介绍了组以及面试流程，约了之后跟manager的call。
2. hiring manager的informational call：也是聊背景，项目，为什么跳槽，behavior问了你收到过最有帮助的评价是什么和为什么，你给别人过什么有帮助的评价。问得比较细，建议多讲讲细节。然后他介绍了组，我提了些问题。挂了电话20分钟就收到recruiter邮件说约电面时间，灰常高效。
3. 电面：好像是英语很棒的国人妹子。
题目是求一个数的squareroot。答案不一定是整数，input可以有一个precision。二分就行，在引导下完善了一些edge case。电
面用的code pair，跑了几个test，聊了时间复杂度。还比较顺，剩下聊了20分钟的天，关于组的信息之类的。。。第二天收到邮件约onsite。

get(key)
put(key, value)
getAtVersion(Key, VersionNumber)

design class表示file system 和 file

（1）设计一个跟踪用户看广告，点击广告，以及下载应用的系统。
（2）蠡口 幺叁玖：分词之壹