注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
开花堡电面:
一个很nice的美国人,简单的自我介绍后,开始coding:
1. 给一个boolean array numbers , 如果numbers index 是prime number, update array[index] 为 true else false. range 是[2, numbers.length-1]
for(int i=2; i<numbers.length; i++) {.google и
if (numbers[i]) {
for(int j = 2; j * i <= numbers.length; j++) {
numbers[i*j] = false;
}
}
}
2. 使用LRU 结构储存url.
. Χ/ API & storage design: class for maintaining the URL history function of a web browser
// each visit to a unique URL (string) is recorded
// if the same URL is visited again, it should not be duplicated, but should be moved to the front of the list
public class BrowserHistory {
// function to record a visited URL
// function to return list of visited URLs in chronological order.
// (assume most recent to oldest, but allow flexibility for reverse order later)
// data members, helper functions?
一天后,面试官通知过了,不过第二轮电面。
|