- 博客(19)
- 资源 (1)
- 收藏
- 关注
原创 LeetCode 572. Subtree of Another Tree
572. Subtree of Another TreeGiven two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a ...
2018-07-31 21:16:50 74
原创 LeetCode 652. Find Duplicate Subtrees
652. Find Duplicate SubtreesGiven a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the root node of any one of them.Two trees are duplicat...
2018-07-31 21:11:35 174
原创 LeetCode 219. Contains Duplicate II
219. Contains Duplicate IIGiven an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference be...
2018-07-31 20:57:00 77
原创 LeetCode 220. Contains Duplicate III
220. Contains Duplicate IIIGiven an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[i] and nums[j] is at most t...
2018-07-31 20:49:38 77
原创 LeetCode 49. Group Anagrams
49. Group AnagramsGiven an array of strings, group anagrams together.Example:Input: [“eat”, “tea”, “tan”, “ate”, “nat”, “bat”], Output: [ [“ate”,”eat”,”tea”], [“nat”,”tan”], [“bat”] ...
2018-07-31 16:17:46 156
原创 C++ string to int && int to string [自己开发的博客网站,欢迎访问](www.weiboke.online) www.weiboke.online
string to intint stoi (const string& str, size_t* idx = 0, int base = 10);int atoi (const char * str); (要调用std::string::c_str() 将string to const char* 才能使用函数,效率自然比上一个慢很多)int to string...
2018-07-31 09:56:14 3143
原创 [WXM] LeetCode 473. Matchsticks to Square
473. Matchsticks to SquareRemember the story of Little Match Girl? By now, you know exactly what matchsticks the little match girl has, please find out a way you can make one square by using up all ...
2018-07-30 21:05:13 199
原创 LeetCode 542. 01 Matrix
542. 01 MatrixGiven a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.The distance between two adjacent cells is 1. Example 1: Input:0 0 0 0 1 0 0 0 0 Output: ...
2018-07-30 20:39:11 177
原创 LeetCode 108. Convert Sorted Array to Binary Search Tree&&109. Convert Sorted List to Binar
108. Convert Sorted Array to Binary Search Tree&&109. Convert Sorted List to BinarGiven a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST...
2018-07-30 20:30:12 94
原创 LeetCode 417. Pacific Atlantic Water Flow
417. Pacific Atlantic Water FlowGiven an m x n matrix of non-negative integers representing the height of each unit cell in a continent, the “Pacific ocean” touches the left and top edges of the mat...
2018-07-30 20:20:02 192
原创 PAT 1147 Heaps(30 分) [自己开发的博客网站,欢迎访问](www.weiboke.online) www.weiboke.online
1147 Heaps(30 分)In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either greater t...
2018-07-30 20:10:27 305
原创 PAT 1146 Topological Order(25 分) [自己开发的博客网站,欢迎访问](www.weiboke.online) www.weiboke.online
1146 Topological Order(25 分)This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed graph? Now you are suppo...
2018-07-30 20:04:12 311
原创 LeetCode 721. Accounts Merge
721. Accounts MergeGiven a list accounts, each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails representing emails...
2018-07-30 19:57:12 165
原创 LeetCode 449. Serialize and Deserialize BST
449. Serialize and Deserialize BSTSerialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted ac...
2018-07-25 21:52:35 105
原创 LeetCode 399. Evaluate Division
399. Evaluate DivisionEquations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the ...
2018-07-25 21:27:57 161
原创 LeetCode 802. Find Eventual Safe States
802. Find Eventual Safe StatesIn a directed graph, we start at some node and every turn, walk along a directed edge of the graph. If we reach a node that is terminal (that is, it has no outgoing di...
2018-07-25 20:55:49 174
原创 LeetCode 863. All Nodes Distance K in Binary Tree
863. All Nodes Distance K in Binary TreeWe are given a binary tree (with root node root), a target node, and an integer value K.Return a list of the values of all nodes that have a distance K fr...
2018-07-25 17:42:07 205
原创 LeetCode 785. Is Graph Bipartite
785. Is Graph BipartiteGiven an undirected graph, return true if and only if it is bipartite.Recall that a graph is bipartite if we can split it's set of nodes into two independent subsets A and...
2018-07-25 17:33:48 203
原创 LeetCode 310. Minimum Height Trees
310. Minimum Height Trees(MHT)For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible rooted trees, those w...
2018-07-25 17:11:24 104
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人