摘要:
Union Find: 顾名思义,分为两个部分 Union 和 Find: Union:合并两个集合,也就是这将两个集合中较大的集合的root作为union后集合的root。类似于大公司合并小公司,大公司CEO同时成为小公司CEO。 Find:查询一个集合的Root。 类似于查询员工所属的CEO。 阅读全文
摘要:
Substring Anagrams Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings consists of lowercase English l 阅读全文
摘要:
Topological Sorting Given an directed graph, a topological order of the graph nodes is defined as follow: For each directed edge A -> B in graph, A mu 阅读全文
摘要:
Graph Valid Tree Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whethe 阅读全文
摘要:
Description: 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 阅读全文
摘要:
Median of two Sorted Arrays There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. Example Given 阅读全文
摘要:
买卖股票系列 && Subarray相关题目:Best Time to Buy and Sell Stock I && II && III (IV 单独开贴)Maximum Subarray I && II为什么这些我要总结到一起呢?因为思路基本一致。题目简略:买卖股票1: 一次买卖,利润最大。买卖... 阅读全文
摘要:
Rotate ListGiven a list, rotate the list to the right bykplaces, wherekis non-negative.ExampleGiven1->2->3->4->5and k =2, return4->5->1->2->3.SOLUTION... 阅读全文
摘要:
Add Two NumbersYou have two numbers represented by a linked list, where each node contains a single digit. The digits are stored inreverseorder, such ... 阅读全文
摘要:
Remove Duplicates from Sorted List IIGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the or... 阅读全文