摘要:
bisect模块用于二分查找,非常方便。 Bisect模块提供的函数有: 1.查找 bisect.bisect_left(a,x, lo=0, hi=len(a)) : 查找在有序列表a中插入x的index。lo和hi用于指定列表的区间,默认是使用整个列表。 bisect.bisect_right( 阅读全文
摘要:
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: 阅读全文