数据结构描述
var users = [ {id: 1, username: '123', authPlayerIds: [1001, 1002, 1003]}, {id: 2, username: 'qwe', authPlayerIds: [1003, 1004, 1005]}, {id: 3, username: 'fdf', authPlayerIds: [1002, 1007, 1088]}, {id: 4, username: 'dsa', authPlayerIds: [1001, 1022, 1033]}, ... // 注意: 数据在`20000`以上]
需求描述
计算authPlayerIds
字段中的每一项(id
)所出现的次数以及包含它的用户(user
)
性能优先(首选
)
处理结束后的数据结构
var authPlayers = { '1001': [ {id: 1, username: '123'}, {id: 4, username: 'dsa'} ], '1002': [ {id: 1, username: '123'}, {id: 3, username: 'fdf'}, {id: 4, username: 'dsa'}, ], '1003': [ {id: 1, username: '123'}, {id: 2, username: 'qwe'}, ] }
语言及工具描述
JavaScript
Node.js
Lodash
underscore
async
bluebird
一切你想用的工具都可以
在线急等...
是时候表演真正的技术了
摇曳的蔷薇
大话西游666