摘要: bisect模块用于二分查找,非常方便。 Bisect模块提供的函数有: 1.查找 bisect.bisect_left(a,x, lo=0, hi=len(a)) : 查找在有序列表a中插入x的index。lo和hi用于指定列表的区间,默认是使用整个列表。 bisect.bisect_right( 阅读全文
posted @ 2016-04-26 23:55 周洋 阅读(1449) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 阅读全文
posted @ 2016-04-26 03:15 周洋 阅读(217) 评论(0) 推荐(0) 编辑