- 博客(18)
- 收藏
- 关注
原创 算法课后题8.8
题目: 在精确的4SAT(EXACT 4SAT)问题中,输入为一组子句,每个子句都是恰好4个文字的析取,且每个变量最多在每个子句中出现一次。目标是求它的满足赋值(如果该赋值存在)。证明精确的4SAT问题是NP-完全问题。 解答: 首先证明EXACT 4SAT 属于 NP,然后再通过将 3SAT 归约到 EXACT 4SAT 来证明后者的 NP 完全性。 EX
2017-07-10 11:39:15
188
原创 609. Find Duplicate File in System
Given a list of directory info including directory path, and all the files with contents in this directory, you need to find out all the groups of duplicate files in the file system in terms of their
2017-06-21 16:57:29
209
原创 538. Convert BST to Greater Tree
Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in BST. Exampl
2017-06-21 16:54:59
156
原创 477. Total Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Now your job is to find the total Hamming distance between all pairs of the given
2017-06-21 16:53:41
156
原创 473. Matchsticks to Square
Remember 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 those matchsticks. You shoul
2017-06-21 16:52:27
151
原创 416. Partition Equal Subset Sum
Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. Note: Each of the array
2017-06-21 16:49:17
127
原创 313. Super Ugly
Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. For example, [1, 2, 4, 7, 8, 13, 1
2017-06-21 16:47:00
281
原创 264. Ugly Number II
Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first
2017-06-21 16:45:14
112
原创 43. Multiply Strings
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2. Note: The length of both num1 and num2 is Both num1 and num2 contains only digits 0
2017-06-21 16:43:02
120
原创 343. Integer Break
Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get. For example, given n = 2, ret
2017-06-05 08:56:59
149
原创 377. Combination Sum IV
Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.Example:nums = [1, 2, 3] target = 4 The possible
2017-06-05 08:55:09
155
原创 474. Ones and Zeroes
In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue.For now, suppose you are a dominator of m 0s and n 1s respectively. On the other ha
2017-06-05 08:53:03
177
原创 55. Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you ar
2017-05-16 15:59:08
154
原创 134. Gas Station
There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its ne
2017-05-16 15:54:32
194
原创 452. Minimum Number of Arrows to Burst Balloons Java解法
There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it's horizontal, y-coordin
2017-05-16 15:50:54
215
1
原创 215. Kth Largest Element in an Array
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. For example, Given [3,2,1,5,6,4] and k = 2, return 5.
2017-03-11 15:54:39
210
原创 241. Different Ways to Add Parentheses
Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *. Example 1 In
2017-03-04 15:32:04
172
原创 LeetCode 2. Add Two Numbers python 解法
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return i
2017-02-26 22:46:48
402
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人