题目描述 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.Given any two nodes in a ...
分类:
其他好文 时间:
2019-02-16 15:39:54
阅读次数:
191
21. Merge Two Sorted Lists Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of th ...
分类:
Web程序 时间:
2019-02-16 13:28:29
阅读次数:
211
24. Swap Nodes in Pairs Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list's nodes, onl ...
分类:
Web程序 时间:
2019-02-16 13:20:04
阅读次数:
157
算法描述: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Example 1: Example 2: Follow ...
分类:
其他好文 时间:
2019-02-15 19:52:15
阅读次数:
183
Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules ...
分类:
其他好文 时间:
2019-02-15 17:25:00
阅读次数:
196
P3143 [USACO16OPEN]钻石收藏家Diamond Collector 题意要注意一点:有两个陈列架! 如果只有一个陈列架,是很容易的。two pointers直接从左到右跑一下即可。 如果有两个陈列架,就需要进行答案合并了。做法是这样的: 设两个数组: 1. $pre$数组,$pre[ ...
分类:
其他好文 时间:
2019-02-15 01:27:58
阅读次数:
245
"152. Combinations" / "77. Combinations" 本题难度: Medium Topic: Search & Recursion Description Given two integers n and k, return all possible combinatio ...
分类:
其他好文 时间:
2019-02-15 01:11:29
阅读次数:
181
Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident ...
分类:
其他好文 时间:
2019-02-14 22:19:34
阅读次数:
204
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n ...
分类:
其他好文 时间:
2019-02-14 15:05:23
阅读次数:
168
The well known Fibonacci sequence is obtained by starting with 0 and 1 and then adding the two last numbers to get the next one. For example the third ...
分类:
其他好文 时间:
2019-02-14 00:20:19
阅读次数:
131