- 博客(14)
- 资源 (3)
- 收藏
- 关注
原创 Linux命令总结
1.ls [选项] [目录名 | 列出相关目录下的所有目录和文件-a 列出包括.a开头的隐藏文件的所有文件-A 通-a,但不列出"."和".."-l 列出文件的详细信息-c 根据ctime排序显示-t 根据文件修改时间排序---color[=WHEN] 用色彩辨别文件类型 WHEN 可以是'never'、'always'或'auto'其中之一 白色:表示普通文件 ...
2019-01-19 20:23:56 294
原创 clone graph(克隆一个图)
题目描述Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ’s undirected graph serialization:Nodes are labeled uniquely.We use #as a separator for each no...
2019-01-14 20:38:04 714
原创 binary tree level order traversal ii)(二叉树自下向上层序遍历)
题目描述Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree{3,9,20,#,#,15,7},...
2019-01-13 15:49:10 170
原创 pascals triangle ii(杨辉三角、帕斯卡三角)
题目描述Given an index k, return the k th row of the Pascal’s triangle.For example, given k = 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use only O(k) extra space?题目大意给定一个索引值k,返回杨辉...
2019-01-12 12:26:14 202
原创 pascals triangle(杨辉三角、帕斯卡三角)
题目描述Given numRows, generate the first numRows of Pascal’s triangle.For example, given numRows = 5,Return:[[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]题目大意杨辉三角给定一个非负整数 numRows,生成杨辉三角的前 numRo...
2019-01-11 17:26:59 508
原创 remove duplicates from sorted array ii(从重复数组中移除重复元素)
类似问题:remove duplicates from sorted list(移除有序链表中的重复元素)题目描述Follow up for “Remove Duplicates”:What if duplicates are allowed at most twice?For example,Given sorted array A =[1,1,1,2,2,3],Your fun...
2019-01-10 20:16:40 544
原创 plus-one(加一)
题目描述Given a number represented as an array of digits, plus one to the number.题目大意用一个数组表示一个数,把这个数做加一操作。思路不需要flag!从右向左,遇到9就变0,非9就加1,然后break;digits[0]如果等于0,说明长度增加了1,则新插入一个首位,首位为1,其他位为0。代码#includ...
2019-01-09 11:50:28 371
原创 merge-sorted-array(合并已排序的数组)
题目描述Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space to hold additional elements from B. The number of elements initialized in...
2019-01-08 15:58:24 1181
原创 count-and-say
题目描述The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, …1 is read off as"one 1"or11.1 1is read off as"two 1s"or21.2 1is read off as"one 2, thenon...
2019-01-06 20:55:53 201
原创 swap nodes in pairs(成对的交换链表结点)
题目描述Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algorithm should use only con...
2019-01-05 16:50:39 191
原创 Symmetric Tree(对称树)
题目描述Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric:But the following is not:Note:Bonus points if you co...
2019-01-05 12:57:18 333
原创 permutations(全排列)
题目描述Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2], and[3,2,1].题目大意给定一个数组集合,返回所有可能的排列。...
2019-01-03 16:42:27 5937
原创 Path Sum(路径和)
题目描述Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree andsu...
2019-01-02 19:31:45 182
原创 remove duplicates from sorted list(移除有序链表中的重复元素)
题目描述Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given1->1->2, return1->2.Given1->1->2->3->3, return1->2->3.题目大...
2019-01-01 15:52:36 334
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人