上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 16 下一页
摘要: # 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 月为暮 阅读(283) 评论(0) 推荐(0) 编辑
摘要: # 这道题想法是很简单的,但是我代码写起来就写了很多。class Solution: def addStrings(self, num1: str, num2: str) -> str: # 保证num1是字符串长的那个 if len(num1) < len(num2) : num1,num2 = 阅读全文
posted @ 2020-08-03 20:42 月为暮 阅读(179) 评论(0) 推荐(0) 编辑
摘要: # 爬虫思路:首先找到约会吧的链接地址,# 然后获取网页,从中提取出每个发消息用户的详情页,找到存放图片的详情页链接,# 根据地址爬取图片import requests,parsel# 用来获取约会吧主页的函数def get_yuehuiba_url(url,headers): # 通过reques 阅读全文
posted @ 2020-08-02 22:08 月为暮 阅读(305) 评论(0) 推荐(0) 编辑
摘要: 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 月为暮 阅读(260) 评论(0) 推荐(0) 编辑
摘要: # 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 月为暮 阅读(198) 评论(0) 推荐(0) 编辑
摘要: # 这道题我是用动态规划的方法来做的。# 遍历从1 ~ n 里边所有的数差分后的最大乘积,# 然后从中找出两个数相加等于n,判断其中的最大乘积是多少。# 注意,这里还有一种可能,就是这个数的最大乘积,没有这个数本身大。# 所以判断的时候用max(index2,dp[index2])class Sol 阅读全文
posted @ 2020-07-30 13:31 月为暮 阅读(198) 评论(0) 推荐(0) 编辑
摘要: from typing import List# 这道题看了大佬写的代码,经过自己的理解写出来了。# 从最外围的四周找有没有为O的,如果有的话就进入深搜函数,然后深搜遍历# 判断上下左右的位置是否为Oclass Solution: def solve(self, board: List[List[s 阅读全文
posted @ 2020-07-29 19:49 月为暮 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 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 月为暮 阅读(210) 评论(0) 推荐(0) 编辑
摘要: # 导入需要的包import requestsimport time,randomfrom openpyxl import Workbookimport pymysql.cursors#@ 连接数据库;# 这个是我本地上边运行的程序,用来获取代理服务器。def get_proxy(): try: P 阅读全文
posted @ 2020-07-25 15:05 月为暮 阅读(310) 评论(0) 推荐(0) 编辑
摘要: 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 月为暮 阅读(521) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 16 下一页