一:解题思路 Time:O(n),Space:O(n) 二:完整代码示例 (C++版和Java版) C++: class Solution { public: vector<vector<int>> zigzagLevelOrder(TreeNode* root) { vector<vector<i ...
分类:
其他好文 时间:
2020-04-17 23:47:41
阅读次数:
72
@ "TOC" 一、元组和列表的区别 元组与列表的区别是: 不可修改,只读列表 列表中的:元素赋值、删除元素、分片赋值、append()、extend()、insert()、pop()、remove()、reverse()、sort()等函数在元组中都不可使用 乘法、索引取值、tuple( )、切片 ...
分类:
编程语言 时间:
2020-04-17 12:27:46
阅读次数:
70
整理了以下数组方法 join() push()和pop() shift() 和 unshift() sort() reverse() concat() slice() splice() indexOf()和 lastIndexOf() (ES5新增) forEach() (ES5新增) map() ...
分类:
编程语言 时间:
2020-04-17 00:40:54
阅读次数:
72
In the wilds far beyond lies the Land of Sacredness, which can be viewed as a tree — connected undirected graph consisting of nn nodes and n?1n?1 edge ...
分类:
其他好文 时间:
2020-04-17 00:11:27
阅读次数:
66
编写一个函数,其作用是将输入的字符串反转过来。输入字符串以字符数组 char[] 的形式给出。 不要给另外的数组分配额外的空间,你必须原地修改输入数组、使用 O(1) 的额外空间解决这一问题。 你可以假设数组中的所有字符都是 ASCII 码表中的可打印字符。 示例 1: 输入:["h","e","l ...
分类:
编程语言 时间:
2020-04-16 14:58:52
阅读次数:
64
var str = prompt("请输出任意的内容:"); //var arr = str.split(""); //arr.reverse(); //str = arr.join(""); str = str.split("").reverse().join(""); alert(str); ...
分类:
其他好文 时间:
2020-04-15 21:10:18
阅读次数:
57
不要给另外的字符串分配额外的空间,你必须原地修改输入字符串、使用 O(1) 的额外空间解决这一问题。package mainfunc Reverse(s string) string { r := []rune(s) for i, j := 0, len(r)-1; i < j; i, j = i+ ...
分类:
其他好文 时间:
2020-04-15 18:43:46
阅读次数:
104
The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants. A binary search tree (BST) i ...
分类:
其他好文 时间:
2020-04-14 18:37:40
阅读次数:
59
看题时发现这题,本来想用数组,但一看要求需要用递归,摸不着头脑。 首先,要介绍一下递归概念 最终肯定有一个递结束的条件,例如上面的已知的f(1)的值。 1 #include<stdio.h> 2 void reverse_string(char * string) 3 { 4 if(*string! ...
分类:
其他好文 时间:
2020-04-14 17:05:06
阅读次数:
77
菜鸟教程地址:https://www.runoob.com/w3cnote/flex-grammar.html flex-direction flex-wrap flex-flow justify-content align-items align-content flex-direction属性决 ...
分类:
其他好文 时间:
2020-04-13 16:43:59
阅读次数:
59