随笔分类 - 编程-python
摘要:class Solution: def generateParenthesis(self, n: int) -> List[str]: if n==1: return ['()'] if not n: return None stack,res,l,r=[],[],[],[] for _ in ra
阅读全文
摘要:class Solution: def simplifyPath(self, path: str) -> str: li=path.split("/") res=[] for i in li: if i=='..' and res: res.pop() if i!='.' and i!='..' a
阅读全文
摘要:class Solution: def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int: n=len(gas) max_gas=0 rest=0 records=[] start=0 for i in range(n)
阅读全文
摘要:Python3中的保留字(关键字) | AmosCloud Wiki
阅读全文
摘要:4.4 Python类的高级特性 | AmosCloud Wiki
阅读全文
摘要:2.4 Python函数式编程特性 | AmosCloud Wiki 解释了为何装饰器需要两个return. 一个return是返回函数名,这是相当于改写了函数名;幸运的是python提供了一个函数functools.wraps解决了这个问题。 另一个return 返回函数操作结果。 特殊地,有方法
阅读全文
摘要:lamda简单构建函数: 冒号“:"前为输入,后为输出 2.4 Python函数式编程特性 | AmosCloud Wiki
阅读全文
摘要:列表可转化成迭代器,iteration=iter(list) 生成器是一个用yeild返回的函数 2.2 Python循环结构与迭代器 | AmosCloud Wiki
阅读全文
摘要:catalog: 1、全局变量、局部变量——函数 1.1具体使用案例 2、类变量、私有变量、保护变量、公开变量——类 2.1 具体使用案例 content:
阅读全文
摘要:2023-09-05 计划 日期 计划 9月5号 二叉树遍历的笔记通过学习整理好,发布 9月6号 9月7号 9月8号 9月9号 9月10号 9月11号 9月12号 9月13号 9月14号 9月15号 9月16号 9月17号 9月18号 9月19号 9月20号 9月21号 9月22号 9月23号 9月
阅读全文
摘要:目录: 1、遍历二叉树的方法三种: 中序遍历,前序遍历,后序遍历 2、使用的数据结构和方法是: a、栈;迭代 b、迭代 3、二叉树遍历的程序实现: 4、基本操作:二叉树的最大深度,最小深度,所有路径。 content: 前序:中左右;中序:左中右;后序:左右中 3、实现代码 python实现二叉树的
阅读全文
摘要:下面采用穷举的方法。但是超时。 注意:题目示例中看起来输出是字符串‘true’or'false'。但是实际输出是bool类型,所以在下面程序中进行了转换。 class Solution: def __init__(self): self.ans='false' def wordBreak(self,
阅读全文
摘要:# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.
阅读全文
摘要:class Solution: def combinationSum(self, candidates, target): res,ans=[],[] def findpath(candidates): if sum(ans)==target: res.append(ans.copy()) retu
阅读全文
摘要:class Solution: def orangesRotting(self, grid: list[list[int]]) -> int: m,n=len(grid),len(grid[0]) queue,good=[],[] def bfs(queue,good,m,n,grid): time
阅读全文
摘要:class Solution: def combine(self, n: int, k: int): nums=[x+1 for x in range(n)] res,ans=[],[] def dfs(nums:list[int]): if len(ans)==k: ans_copy=ans.co
阅读全文
摘要:(20条消息) python opencv图像叠加/图像融合/mask掩模_cv2读取灰度图像和rgb图像叠加_DLANDML的博客-CSDN博客 Python OpenCV中的逻辑运算之mask参数理解 - 知乎 (zhihu.com)
阅读全文
摘要:参考网页: (19条消息) OpenCV | 直线拟合fitline函数(Python)_cv2.fitline_lovetaozibaby的博客-CSDN博客 例子,出来的结果是非常多直线的,所以需要在拟合前检测出图像焊缝,并提取出拟合点,再进行霍夫变换。 import cv2 import nu
阅读全文
摘要:参考:(17条消息) PyQt5在textBrowser添加文本并自动滑动到底_pyqt5 textbrowser_SQZHAO的博客-CSDN博客
阅读全文
摘要:1、自定义信号 mysignal 定义要放在函数外面。 import sys from PyQt5 import QtCore, QtGui, QtWidgets import cv2 import threading import numpy as np class Ui_MainWindow(Q
阅读全文

浙公网安备 33010602011771号