其他分享
首页 > 其他分享> > Code Tricks

Code Tricks

作者:互联网

这里写目录标题

Condition

边界

排序过的list

if not nums or target < nums[0] or target > nums[-1]:
return[-1, -1]

Number

等效Java里Max/Min的式子

themax = float('inf')
themin = float('-inf')
themax = sys.maxsize
themin = sys.minsize

IEEE 754 floating point numbers can represent positive or negative infinity, and NaN (not a number)

x 同时是3和5的倍数

代码保证返回boolean

not (i % 15)

Calculation

中间数

常用于二分法的代码

mid = (left + right)>>1
#或者
mid = left + (right - left) // 2

Sparse matrix multiplication

https://stackoverflow.com/questions/13272453/multiplying-numpy-scipy-sparse-and-dense-matrices-efficiently

标签:Code,Java,nums,Tricks,Min,list,mid,left
来源: https://blog.csdn.net/u013302570/article/details/120735773