Leetcode: Google interview questions #3
2. give integer, 12345, 返回 32154先把integer转为string,然后前半部分翻转,再后半部分翻转
或直接数一下integer一共多少位
give a target string and list of strings, find the longest string that
has target as prefix, follow up, stream of target string, 用trie,每个节点保
留最长string信息。
3. integer array add one
rotation abc->bcd->cde, give a list of strings, group them if them are
rotations.
居然给我laptop,然后直接上面写,然后debug通过,给test case通过
4. given grid of colors, coordinate of a point and its color, find the
perimeter of the region that has the same color of that point.
BFS或DFS,构成perimeter的条件是只要上下左右有一个不是同颜色或者是out of bound
用一个set记录visit的信息
print all morse code given the length constraints, short "*" takes one
, long "——"takes two. (find a bug in the code) 就是排列组合的典型题
5. design: chromecast, how to know which app can be supported? There is a
cloud that can give the information to the chrome cast, appID, deviceID,
cache design.
Read full article from Leetcode: Google interview questions #3