注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
先自我介绍,10分钟
coding 第一问:
给一个 counts list, 问找出 top n 个 word length 在 2 到 k 的 words,
counts = [
"POINT,333858038",
"NOT,4522732626",
"INTO,1144226142",
"ON,4594521081",
"FOR,6545282031",
"NOW,679337516",
"ONE,2148983086",
"BEHAVIOR,104177552",
"WAITS,2911079",
"PEOPLE,658716166",
"HI,15453893",
"FORM,352032932",
"OF,30966074232",
"THROUGH,647091198",
"BETWEEN,744064796",
"FOUR,262968583",
"LEFT,306802162",
"OFF,302535533",
"FROM,3469207674",
"NO,1400645478",
"FORMS,136468034",
[ INTO ]
OF : [ FOR, OFF ]
NOW : []
POINT : []
ON : [ ONE, NOT, NOW ]
Complexity analysis variables:
n: The number of words in the word list.
k: The maximum length of any word in the word list
dict = {word_len : word, 2 : [word]}
for k, v in dict.items():
"""
|