会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
月为暮
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
3
4
5
6
7
8
9
10
11
···
16
下一页
2020年8月5日
337打家劫舍III
摘要: # Definition for a binary tree node.class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = Nonea = TreeNode(3)b = TreeNode(
阅读全文
posted @ 2020-08-05 12:57 月为暮
阅读(289)
评论(0)
推荐(0)
2020年8月3日
415字符串相加
摘要: # 这道题想法是很简单的,但是我代码写起来就写了很多。class Solution: def addStrings(self, num1: str, num2: str) -> str: # 保证num1是字符串长的那个 if len(num1) < len(num2) : num1,num2 =
阅读全文
posted @ 2020-08-03 20:42 月为暮
阅读(190)
评论(0)
推荐(0)
2020年8月2日
05爬取约会吧美女全部照片
摘要: # 爬虫思路:首先找到约会吧的链接地址,# 然后获取网页,从中提取出每个发消息用户的详情页,找到存放图片的详情页链接,# 根据地址爬取图片import requests,parsel# 用来获取约会吧主页的函数def get_yuehuiba_url(url,headers): # 通过reques
阅读全文
posted @ 2020-08-02 22:08 月为暮
阅读(329)
评论(0)
推荐(0)
2020年7月31日
148排序链表
摘要: class ListNode: def __init__(self, x): self.val = x self.next = Nonea = ListNode(1)b = ListNode(3)c = ListNode(2)d = ListNode(1)e = ListNode(5)a.next
阅读全文
posted @ 2020-07-31 12:49 月为暮
阅读(262)
评论(0)
推荐(0)
2020年7月30日
145二叉树的后序遍历
摘要: # Definition for a binary tree node.class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None# 后序遍历,先遍历左子树,在遍历右子树,在遍历根节点。
阅读全文
posted @ 2020-07-30 19:07 月为暮
阅读(201)
评论(0)
推荐(0)
343整数拆分
摘要: # 这道题我是用动态规划的方法来做的。# 遍历从1 ~ n 里边所有的数差分后的最大乘积,# 然后从中找出两个数相加等于n,判断其中的最大乘积是多少。# 注意,这里还有一种可能,就是这个数的最大乘积,没有这个数本身大。# 所以判断的时候用max(index2,dp[index2])class Sol
阅读全文
posted @ 2020-07-30 13:31 月为暮
阅读(203)
评论(0)
推荐(0)
2020年7月29日
130被围绕的区域
摘要: from typing import List# 这道题看了大佬写的代码,经过自己的理解写出来了。# 从最外围的四周找有没有为O的,如果有的话就进入深搜函数,然后深搜遍历# 判断上下左右的位置是否为Oclass Solution: def solve(self, board: List[List[s
阅读全文
posted @ 2020-07-29 19:49 月为暮
阅读(242)
评论(0)
推荐(0)
129求根到叶子节点数字之和
摘要: class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = Nonea = TreeNode(1)b = TreeNode(2)c = TreeNode(3)a.left = ba.right =
阅读全文
posted @ 2020-07-29 18:44 月为暮
阅读(216)
评论(0)
推荐(0)
2020年7月25日
04爬取拉勾网Python岗位分析报告
摘要: # 导入需要的包import requestsimport time,randomfrom openpyxl import Workbookimport pymysql.cursors#@ 连接数据库;# 这个是我本地上边运行的程序,用来获取代理服务器。def get_proxy(): try: P
阅读全文
posted @ 2020-07-25 15:05 月为暮
阅读(316)
评论(0)
推荐(0)
2020年7月20日
24 两两交换链表中的节点
摘要: class ListNode: def __init__(self, x): self.val = x self.next = Noneclass Solution: def swapPairs(self, head: ListNode) -> ListNode: # 定义一个节点,并将它指向头结点
阅读全文
posted @ 2020-07-20 22:07 月为暮
阅读(528)
评论(0)
推荐(0)
上一页
1
···
3
4
5
6
7
8
9
10
11
···
16
下一页
公告