上机题还是profile id,之前面经有一个很重要的遗漏,就是get(profileid,version)
需要返回的是所有小于等于给定version那个profile的fieldname和fieldvalue, 
而不是只是那个version下的,而且返回值需要按fieldname排序,所以用treemap的floor会很有效率, 
思路讲一下把:map>>, 这样好处就是去掉了fieldname的重复,节省了空间。 代码就不贴了,建议大家先写好,时间挺紧的

链接: https://instant.1point3acres.com/thread/270073
来源: 一亩三分地
HackerRank 新题,我的解法不够优,很多大数据点超时了。
大概是一个简历的系统,实现三个 API 
1) update(String profileId, String field, String value); 
2) get(String profileId, int version); 
3) getField(String profileId, int version, String field); 
每个用户有一个 profile,然后 profile 里有各种 field 和对应的 value,
第一次 update 之后的 version 是 1,再 update version 变成 2,依此类推。

results matching ""

    No results matching ""