注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
7月6日收到OA,7日完成,至今2周过去了没有任何结果,发邮件过去询问也不回复。
2个小时一共3题,第一题非常简单,以至于我现在怎么也想不起来了,反正即使从来不刷题也应该能做出来。
第二题力扣妻儿,稍有变化,去掉了replace,只考虑insert和delete。
第三题没见过,大概是这样的:
Approximate Matching
You are given 3 strings: text, pre_text and post_text. Let L be a substring of text.
For each substring L of text, we define pattern_score as follows:
* pre_text_pattern_score = highest n, such that first n characters of L are equal to the last n characters of pre_text and occur in the same exact order.
* post_text_pattern_score = highest n such that last n characters of L are equal to the first n characters of post_text and occur in the same exact order.
* pattern_score = pre_text_pattern_score + post_text_pattern_score
For example, if L = "nothing", pre_text = "bruno", and post_text in mapScore:
mapScore[substring] = (patternScore, preScore)
else:
if patternScore > mapScore[substring][0]:
mapScore[substring] = (patternScore, preScore)
elif patternScore == mapScore[substring][0] and preScore > mapScore[substring][1]:
mapScore[substring] = (patternScore, preScore)
result = sorted(mapScore.items(), key = lambda x: (-x[1][0], -x[1][1], x[0]))
return result[0][0]
感觉还是有点难度 |