- 博客(20)
- 收藏
- 关注
原创 算法概论习题8.3题解
题目: 8.3. STINGY SAT is the following problem: given a set of clauses (each a disjunction of literals) andan integer k, find a satisfying assignment in which at most k variables are true, if
2017-07-06 11:01:13 394
原创 LeetCode-algorithms 532. K-diff Pairs in an Array
题目:Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i and j are both
2017-07-04 09:30:12 260
原创 LeetCode-algorithms 523. Continuous Subarray Sum
题目:Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to the multiple of k, that is,
2017-06-28 15:26:37 269
原创 LeetCode-algorithms 198. House Robber
题目:· You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjac
2017-06-26 22:50:27 213
原创 LeetCode-algorithms 399. Evaluate Division
题目:Equations 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 answers.
2017-06-14 09:25:13 425
原创 LeetCode-algorithms 49. Group Anagrams
题目:Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]
2017-06-02 16:33:31 322
原创 LeetCode-algorithms 25. Reverse Nodes in k-Group
题目:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equal to the length of the linked list. If the
2017-05-30 12:30:30 331
原创 LeetCode-algorithms 413. Arithmetic Slices
题目:A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.For example, these are arithmetic
2017-05-21 23:23:05 293
原创 LeetCode-algorithms 357. Count Numbers with Unique Digits
题目:Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x n.Example:Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x
2017-05-14 23:23:58 265
原创 LeetCode-algorithms 15. 3Sum
题目:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set m
2017-05-05 13:21:59 235
原创 LeetCode-algorithms 145. Binary Tree Postorder Traversal
题目:Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Recu
2017-05-01 21:40:57 244
原创 LeetCode-algorithms 47. Permutations II
题目:Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[ [1,1,2], [1,2,1],
2017-04-24 12:51:05 347
原创 LeetCode-algorithms 39. Combination Sum
题目:Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be
2017-04-17 23:21:19 239
原创 LeetCode-algorithms 34. Search for a Range
题目:Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).
2017-04-05 19:44:36 246
原创 LeetCode-algorithms 17. Letter Combinations of a Phone Number
题目:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Dig
2017-04-05 18:26:44 228
原创 LeetCode-algorithms 46. Permutations
题目:Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2],
2017-03-27 12:41:52 251
原创 LeetCode-algorithms 48. Rotate Image
题目:You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?思考:由于题目要求是在矩阵本身上做操作,这里就要考虑转换后的位置关系
2017-03-19 23:12:44 699
原创 LeetCode-algorithms 5. Longest Palindromic Substring
题目:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: "babad"Output: "bab"Note: "aba" is also a valid ans
2017-03-12 16:19:54 301
原创 LeetCode-algorithms 10. Regular Expression Matching
LeetCode-algorithms 10. Regular Expression Matchingleetcode_ID:a191705907date:2017-3-5
2017-03-04 17:18:21 350
原创 LeetCode-algorithms 22. Generate Parentheses
题目: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()"
2017-02-26 20:18:25 268
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人