随笔分类 -  Leetcode

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 23 下一页
摘要:There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to 阅读全文
posted @ 2018-12-13 21:33 Veritas_des_Liberty 阅读(209) 评论(0) 推荐(0) 编辑
摘要:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced bina 阅读全文
posted @ 2018-12-12 18:12 Veritas_des_Liberty 阅读(174) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example: Approach #1: C++. [recursive] Approach #2: Java. 阅读全文
posted @ 2018-12-11 21:51 Veritas_des_Liberty 阅读(158) 评论(0) 推荐(0) 编辑
摘要:The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each hou 阅读全文
posted @ 2018-12-11 20:39 Veritas_des_Liberty 阅读(213) 评论(0) 推荐(0) 编辑
摘要:Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tick 阅读全文
posted @ 2018-12-11 16:51 Veritas_des_Liberty 阅读(231) 评论(0) 推荐(0) 编辑
摘要:Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or do 阅读全文
posted @ 2018-12-11 13:11 Veritas_des_Liberty 阅读(228) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-12-10 21:58 Veritas_des_Liberty 阅读(207) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. Example 阅读全文
posted @ 2018-12-10 18:00 Veritas_des_Liberty 阅读(202) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 whic 阅读全文
posted @ 2018-12-10 17:15 Veritas_des_Liberty 阅读(191) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any 阅读全文
posted @ 2018-12-10 12:05 Veritas_des_Liberty 阅读(190) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, flatten it to a linked list in-place. For example, given the following tree: The flattened tree should look like: Approach #1: C+ 阅读全文
posted @ 2018-12-10 10:11 Veritas_des_Liberty 阅读(158) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. Note: A leaf is a node with no children. Exampl 阅读全文
posted @ 2018-12-09 21:13 Veritas_des_Liberty 阅读(199) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l 阅读全文
posted @ 2018-12-09 18:53 Veritas_des_Liberty 阅读(178) 评论(0) 推荐(0) 编辑
摘要:Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Example 1: Input: [1,3,null,null,2 阅读全文
posted @ 2018-12-09 18:14 Veritas_des_Liberty 阅读(208) 评论(0) 推荐(0) 编辑
摘要:955. Delete Columns to Make Sorted II We are given an array A of N lowercase letter strings, all of the same length. Now, we may choose any set of del 阅读全文
posted @ 2018-12-09 17:02 Veritas_des_Liberty 阅读(254) 评论(0) 推荐(0) 编辑
摘要:Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1 ... n. Example: Input: 3 Output: [ [1,null,3,2], 阅读全文
posted @ 2018-12-08 21:40 Veritas_des_Liberty 阅读(217) 评论(0) 推荐(0) 编辑
摘要:Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). The binary search tree is g 阅读全文
posted @ 2018-12-04 12:27 Veritas_des_Liberty 阅读(661) 评论(0) 推荐(0) 编辑
摘要:Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree. Exa 阅读全文
posted @ 2018-12-04 11:59 Veritas_des_Liberty 阅读(250) 评论(0) 推荐(0) 编辑
摘要:Implement a MyCalendarThree class to store your events. A new event can always be added. Your class will have one method, book(int start, int end). Fo 阅读全文
posted @ 2018-12-03 19:14 Veritas_des_Liberty 阅读(319) 评论(0) 推荐(0) 编辑
摘要:Implement a MyCalendarTwo class to store your events. A new event can be added if adding the event will not cause a triple booking. Your class will ha 阅读全文
posted @ 2018-12-03 17:27 Veritas_des_Liberty 阅读(486) 评论(0) 推荐(0) 编辑

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 23 下一页