![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
小白刷leetcode
心想卷而力不足
这个作者很懒,什么都没留下…
展开
-
删除排序数组中的重复项,LeetCode,小白操作记录
删除排序数组中的重复项,LeetCode,小白操作记录题干弱鸡解答坑点复盘题干弱鸡解答坑点复盘题干:弱鸡解答:坑点:nums[:]会遍历每个元素,而不会在删除过程中因为长度变小,顺序错位,而导致漏删的现象。重点中的重点,不然会顺序错位。num.pop()中pop后面的参数是下标索引值,所以需要index(i)获取索引...原创 2021-02-22 22:47:22 · 71 阅读 · 0 评论 -
废了,废了,每日一题 Day3
题干如下:import numpy as npclass Solution: def matrixReshape(self, nums: List[List[int]], r: int, c: int) -> List[List[int]]: a=np.array(nums) try: return a.reshape(r,c) except: return nums直接用numpy 做原创 2021-02-17 09:24:16 · 88 阅读 · 0 评论 -
有人相爱,有人夜里开车看海,有人leetcode第一题都做不出来。第二天之两数之和调试记录
def twoSum(nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ for i in nums: print(f'i的值{i}与索引值{nums.index(i)}') for j in nums: print(f'j的值{j}与索引值{nums.index(j)}')原创 2021-02-17 00:44:57 · 822 阅读 · 2 评论