注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
电话面试
---
SnapshotSet Interface,能够用iterator()取某一时刻这个set的所有元素,
在调用iterator()和使用Iterator<T>之间,可以对SnapshotSet进行修改,不考虑多线程,所有操作都是顺序执行。
虚拟现场
---
1. 算法和数据结构
Given a list of firewall rules, such as
[{"192.168.1.22/24": allow}, {"192.168.122.126/20": deny}, ...]
Write a function to determine if an IP is allowed to pass the firewall.
Something like:
boolean canPass(List<Rule> firewall, String ip) {}
2. 编码
Assume we have some static, globally available reference string
// ref_string = ['a', 'b', 'c', '1', '2', '3', '4', 'a', 'b', 'c', 'd', '!'] == "abc1234abcd!"
// (index) = 0 1 2 3 4 5 6 7 8 9 10 11
// Using the reference string, we want to compress a source string
// src_string = ['a', 'b', 'c', 'd', '1', '2', '3'] == "abcd123"
// (index) = 0 1 2 3 4 5 6
// A cover represents a compression of src_string relative to ref_string and is
// comprised of (inclusive, exlcusive) indicies-pairs called "blocks". For example,
// block1 = (7, 11) => "abcd"
// For example, one valid cover for src_string:
// cov1 = [(7, 11), (3, 6)] => ["abcd", "123"]
// Another valid cover for src_string:
// cov2 = [(7, 10), (10, 11), (3, 6)] => ["abc", "d", "123"]
// Implement delete(cover, index)
// Given a valid cover and index of S, return a valid cover for S[:index] + S[index+1:]
// Array[Array[Int]] delete(Array[Array[Int]] cover, Int index)
// cov1 = [(7, 11), (3, 6)]
// abc123
// abcd13
// delete(cov1, 3) = [(7,10), (3,6)}]
// delete(cov1, 5)
// delete(cov1, 0)
// delete(cover1, 3) -> (7,10), (3,6)
/*
* Follow- up, delete(cover, index, ref_str); but you need to return maxim cover
*/
// A "maximal" cover is one in which concatenating any consecutive pair of blocks
// yields a corresponding substring that is not in the reference string.
// cov1 is maximal since ("abcd" + "123") or "abcd123" is not in ref_string
//cov1 = [(7, 11), (3, 6)] => ["abcd", "123"]
// cov2 is NOT maximal since ("abc" + "d") or "abcd" is in ref_string
// cov2 = [(7, 10), (10, 11), (3, 6)] => ["abc", "d", "123"]
// delete(cov1, 3) = [(7,10), (3,6)}] = "abc""123" = (0,6)
3. 系统结构
4. 系统设计
In memory kv store, how to handle multi thread, how to recover from failure.5. 交叉职能,比较基础的Behavior Question
编码第二题followup不会做,高人指点
最后吐槽一句,onsite走大运碰着全国人面试官,在当前市场环境下还以为多少有点帮助,结果系统结构面试官大哥一路各种刨根问底trade off问题,加上楼主自己读太多blog,上来给自己挖太多坑,结果被国人大哥无情问倒,最后给了weak no hire。我真谢了。 |