随笔分类 -  LintCode

摘要:Given n nodes in a graph labeled from 1 to n. There is no edges in the graph at beginning. You need to support the following method:1. connect(a, b), 阅读全文
posted @ 2017-11-12 02:25 Review->Improve 阅读(228) 评论(0) 推荐(0)
摘要:Given n nodes in a graph labeled from 1 to n. There is no edges in the graph at beginning. You need to support the following method:1. connect(a, b), 阅读全文
posted @ 2017-11-12 02:23 Review->Improve 阅读(244) 评论(0) 推荐(0)
摘要:Given n nodes in a graph labeled from 1 to n. There is no edges in the graph at beginning. You need to support the following method: 1. connect(a, b), 阅读全文
posted @ 2017-11-12 02:14 Review->Improve 阅读(603) 评论(0) 推荐(0)
摘要:Find the number Weak Connected Component in the directed graph. Each node in the graph contains a label and a list of its neighbors. (a weak connected 阅读全文
posted @ 2017-11-12 01:50 Review->Improve 阅读(620) 评论(0) 推荐(0)
摘要:Find the number connected component in the undirected graph. Each node in the graph contains a label and a list of its neighbors. (a connected compone 阅读全文
posted @ 2017-11-11 12:24 Review->Improve 阅读(1718) 评论(0) 推荐(0)
摘要:Six degrees of separation is the theory that everyone and everything is six or fewer steps away, by way of introduction, from any other person in the 阅读全文
posted @ 2017-11-11 09:53 Review->Improve 阅读(545) 评论(0) 推荐(0)
摘要:Deep clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. How we serialize an undirected graph: Nodes are l 阅读全文
posted @ 2017-11-11 09:32 Review->Improve 阅读(419) 评论(0) 推荐(0)
摘要: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 whether these edges mak 阅读全文
posted @ 2017-11-10 13:06 Review->Improve 阅读(539) 评论(0) 推荐(0)
摘要:Given a undirected graph, a node and a target, return the nearest node to given node which value of it is target, return NULL if you can't find. There 阅读全文
posted @ 2017-11-10 11:14 Review->Improve 阅读(846) 评论(0) 推荐(0)
摘要:Given an integer array, heapify it into a min-heap array. For a heap array A, A[0] is the root of heap, and for each A[i], A[i * 2 + 1] is the left ch 阅读全文
posted @ 2017-11-08 14:43 Review->Improve 阅读(395) 评论(0) 推荐(0)
摘要: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 @ 2017-11-08 02:09 Review->Improve 阅读(434) 评论(0) 推荐(0)
摘要: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 t 阅读全文
posted @ 2017-11-07 14:47 Review->Improve 阅读(446) 评论(0) 推荐(0)
摘要:Given an directed graph, a topological order of the graph nodes is defined as follow: For each directed edge A -> B in graph, A must appear before B i 阅读全文
posted @ 2017-11-07 12:44 Review->Improve 阅读(414) 评论(0) 推荐(0)
摘要:Given a linked list, determine if it has a cycle in it. Given a linked list, determine if it has a cycle in it. Given a linked list, determine if it h 阅读全文
posted @ 2017-10-13 12:42 Review->Improve 阅读(198) 评论(0) 推荐(0)
摘要:Merge two sorted (ascending) linked lists and return it as a new sorted list. The new sorted list should be made by splicing together the nodes of the 阅读全文
posted @ 2017-10-13 12:27 Review->Improve 阅读(145) 评论(0) 推荐(0)
摘要:Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the 阅读全文
posted @ 2017-10-13 12:16 Review->Improve 阅读(256) 评论(0) 推荐(0)
摘要:Sort a linked list using insertion sort. Sort a linked list using insertion sort. Sort a linked list using insertion sort. Example Given 1->3->2->0->n 阅读全文
posted @ 2017-10-13 11:47 Review->Improve 阅读(171) 评论(0) 推荐(0)
摘要:Given a node from a cyclic linked list which has been sorted, write a function to insert a value into the list such that it remains a cyclic sorted li 阅读全文
posted @ 2017-10-13 11:16 Review->Improve 阅读(208) 评论(0) 推荐(0)
摘要:Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or * between the d 阅读全文
posted @ 2017-09-29 07:26 Review->Improve 阅读(264) 评论(0) 推荐(0)
摘要:Given a digit string excluded 01, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on 阅读全文
posted @ 2017-09-28 11:39 Review->Improve 阅读(300) 评论(0) 推荐(0)