代码改变世界

LeetCode 113. Path Sum II 20170705 部分之前做了没写的题目

2017-07-05 17:50 by 方小呆dai, 231 阅读, 0 推荐, 收藏,
摘要:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example:Given the below binary tree and sum 阅读全文

LeetCode 112. Path Sum 20170705 部分之前做了没写的题目

2017-07-05 15:28 by 方小呆dai, 141 阅读, 0 推荐, 收藏,
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. F 阅读全文

LeetCode 93. Restore IP Addresses 20170705 部分之前做了没写的题目

2017-07-05 11:08 by 方小呆dai, 239 阅读, 0 推荐, 收藏,
摘要:Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given "25525511135", return ["2 阅读全文

LeetCode 90. Subsets II 20170703

2017-07-03 17:47 by 方小呆dai, 199 阅读, 0 推荐, 收藏,
摘要:Given a collection of integers that might contain duplicates, nums, return all possible subsets. Note: The solution set must not contain duplicate sub 阅读全文

LeetCode 515. Find Largest Value in Each Tree Row 20170626本周

2017-06-26 19:40 by 方小呆dai, 132 阅读, 0 推荐, 收藏,
摘要:You need to find the largest value in each row of a binary tree. Example: Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [1, 3, 9] 题目大意:输出树的每一层的最大值 解题思路:广度优先遍历图 阅读全文

LeetCode 547. Friend Circles 20170626 补上周

2017-06-26 19:33 by 方小呆dai, 499 阅读, 0 推荐, 收藏,
摘要:There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct 阅读全文

LeetCode 86. Partition List 20170612

2017-06-12 15:50 by 方小呆dai, 147 阅读, 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 阅读全文

LeetCode 78. Subsets 20170606

2017-06-06 19:53 by 方小呆dai, 168 阅读, 0 推荐, 收藏,
摘要:Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example,If nums =  阅读全文

LeetCode 77. Combinations 20170530补上周

2017-05-30 01:52 by 方小呆dai, 150 阅读, 0 推荐, 收藏,
摘要:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example,If n = 4 and k = 2, a solution is: 题目大意:给定两个整数n和 阅读全文

LeetCode 75. Sort Colors 20170522

2017-05-22 21:03 by 方小呆dai, 149 阅读, 0 推荐, 收藏,
摘要:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, 阅读全文