摘要: Union Find: 顾名思义,分为两个部分 Union 和 Find: Union:合并两个集合,也就是这将两个集合中较大的集合的root作为union后集合的root。类似于大公司合并小公司,大公司CEO同时成为小公司CEO。 Find:查询一个集合的Root。 类似于查询员工所属的CEO。 阅读全文
posted @ 2017-09-25 08:43 Tri_tri_tri 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2017-08-20 05:07 Tri_tri_tri 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2017-08-18 08:20 Tri_tri_tri 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2017-08-18 03:34 Tri_tri_tri 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2017-08-18 03:16 Tri_tri_tri 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 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  阅读全文
posted @ 2017-07-31 09:53 Tri_tri_tri 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 买卖股票系列 && Subarray相关题目:Best Time to Buy and Sell Stock I && II && III (IV 单独开贴)Maximum Subarray I && II为什么这些我要总结到一起呢?因为思路基本一致。题目简略:买卖股票1: 一次买卖,利润最大。买卖... 阅读全文
posted @ 2015-11-20 02:32 Tri_tri_tri 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2015-11-17 12:07 Tri_tri_tri 阅读(128) 评论(0) 推荐(0) 编辑
摘要: Add Two NumbersYou have two numbers represented by a linked list, where each node contains a single digit. The digits are stored inreverseorder, such ... 阅读全文
posted @ 2015-11-17 11:52 Tri_tri_tri 阅读(245) 评论(0) 推荐(0) 编辑
摘要: Remove Duplicates from Sorted List IIGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the or... 阅读全文
posted @ 2015-11-17 11:40 Tri_tri_tri 阅读(147) 评论(0) 推荐(0) 编辑