给你一个二叉树,请你返回其按 层序遍历 得到的节点值。 (即逐层地,从左到右访问所有节点)。 示例: 二叉树:[3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 返回其层次遍历结果: [ [3], [9,20], [15,7] ] class Solution( ...
分类:
其他好文 时间:
2020-07-19 13:49:57
阅读次数:
77
给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 \ 2 / 3 输出: [1,3,2] 进阶: 递归算法很简单,你可以通过迭代算法完成吗? ## 迭代 class Solution: def inorderTraversal(self, root: TreeNod ...
分类:
其他好文 时间:
2020-07-19 11:38:09
阅读次数:
55
栈 用数组实现一个顺序栈 用链表实现一个链式栈 编程模拟实现一个浏览器的前进、后退功能 用数组实现一个顺序栈 class Stack(object): def __init__(self): self.stack=[] def push(self,item): self.stack.append(i ...
分类:
其他好文 时间:
2020-07-19 11:29:50
阅读次数:
48
默认参数 ES5 中如果函数在调用时未提供隐式参数,参数会默认设置为: undefined 有时这是可以接受的,但是建议最好为参数设置一个默认值: 实例(ES5) function myFunction(x, y) { if (y undefined) { y = 0; } } 或者,更简单的方式: ...
分类:
编程语言 时间:
2020-07-19 00:43:37
阅读次数:
125
抓取一波知乎表情图呀,表情来源于知乎某个提问,地址为 https://www.zhihu.com/question/311745535. import requests import re import os class CrawlImg: def __init__(self): self.ques ...
分类:
其他好文 时间:
2020-07-19 00:37:54
阅读次数:
84
package LeetCode_1507 import java.lang.StringBuilder /** * 1507. Reformat Date * https://leetcode.com/problems/reformat-date/description/ * * Given a ...
分类:
其他好文 时间:
2020-07-19 00:30:33
阅读次数:
69
博主本人的运行时,exe可以了,但调试的还是不行,欢迎大家来和我讨论。 具体的我写在有道云了,里面整理了我的解决办法与查到的资料。 文档:将.exe指定目录.note链接:http://note.youdao.com/noteshare?id=d20fb23fa4c0db6408ccc818a731 ...
分类:
编程语言 时间:
2020-07-18 22:51:53
阅读次数:
103
# coding: utf-8 import arcpy class Toolbox(object): def __init__(self): """Define the toolbox (the name of the toolbox is the name of the .pyt file)." ...
分类:
编程语言 时间:
2020-07-18 22:16:15
阅读次数:
119
全局Response对象和全局异常捕获和日志 1. 全局Response对象 from rest_framework.response import Response class APIResponse(Response): def __init__(self, code=100, msg='成功' ...
分类:
其他好文 时间:
2020-07-18 21:51:44
阅读次数:
72
Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results. Note: The input string may cont ...
分类:
其他好文 时间:
2020-07-18 15:29:10
阅读次数:
71