摘要: 最近在刷leetcode,发现很多题目的思路都很相似。其中,collections模块中的Counter()多次在习题中碰到,很有必要对该知识点总结一下,加深理解。 1.collections模块 collections模块自Python 2.4 版本之后,引入除了dict、list、set、tup 阅读全文
posted @ 2017-09-23 16:30 Yancea 阅读(458) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2,2,3] and k = 2, return [1,2]. Note: You may assum 阅读全文
posted @ 2017-09-23 15:57 Yancea 阅读(157) 评论(0) 推荐(0) 编辑