废纸的修炼之旅
Scroll Down最新文章
-
13 2020年07月
-
04 2020年06月2020年06月04日
Leetcode238 除自身以外数组的乘积
题目描述方法一class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: left, right,res = [1] * len(nums), [1] * len(nums),[1] * l
查看全文 -
02 2020年06月2020年06月02日
Leetcode-面试题64. 求1+2+…+n
题目描述方法一class Solution: def sumNums(self, n: int) -> int: return n!=0 and n + self.sumNums(n-1) Note:本题考察逻辑运算符的短路特性if(A && B) /
查看全文 -
01 2020年06月2020年06月01日
Leetcode1013 将数组分成和相等的三个部分
题目描述方法一class Solution: def canThreePartsEqualSum(self, A: List[int]) -> bool: sum_num = sum(A) if(sum_num %3 != 0): return
查看全文 -
14 2020年03月
-
22 2020年02月2020年02月22日
Leetcode73 矩阵置零
题目描述我的解法class Solution: def setZeroes(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place inst
查看全文 -
21 2020年02月2020年02月21日
Leetcode593 有效的正方形
题目描述我的解法import mathclass Solution: def validSquare(self, p1: List[int], p2: List[int], p3: List[int], p4: List[int]) -> bool: def getdistanc
查看全文 -
20 2020年01月
-
18 2020年01月2020年01月18日
Leetcode82 删除排序链表中的重复元素 II
题目描述我的解法# Definition for singly-linked list.# class ListNode:# def __init__(self, x):# self.val = x# self.next = Noneclass Solutio
查看全文 -
08 2020年01月2020年01月08日
NumPy常见运算举例(np.around、np.floor、np.ceil、np.where)
总结np.around()返回四舍五入后的值 可指定精度np.floor()向下取整np.ceil()向上取整np.where()根据condition布尔值从x,y中选择元素,为True时选择x否则选择y(下面基本上是废话)np.aroundnp.around 返回四舍五入值,可以指定精度注意:对
查看全文