- 博客(16)
- 收藏
- 关注
原创 chapter8
作业习题8.3 吝啬sat问题是这样的:给定一组子句(每个子句都是其中文字的析取)和整数k,求一个最多有k个变量为true的满足赋值——如果赋值存在。证明吝啬sat是np完全问题。solution: 首先要证明吝啬SAT问题是NP问题,然后如果能把SAT问题规约到吝啬SAT问题,即可证明这个问题是NP-完全问题。 吝啬SAT问题肯定是NP问题 ,因为吝啬SAT问题是SAT问题的一
2018-01-21 17:34:47 174
原创 LeetCode740
EX740 Given an array nums of integers, you can perform operations on the array. In each operation, you pick any nums[i] and delete it to earn nums[i] points. After, you must delete every element
2017-12-15 15:20:55 270
原创 LeetCode96
EX96 Given n, how many structurally unique BST’s (binary search trees) that store values 1…n? For example, Given n = 3, there are a total of 5 unique BST’s. 1 3 3 2
2017-12-15 14:39:28 217
原创 LeetCode494
EX494 You are given a list of non-negative integers, a1, a2, …, an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + and - as its new symbol. Find
2017-12-13 16:15:01 211
原创 LeetCode416
EX416 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
2017-12-13 15:52:11 342
原创 LeetCode515
EX.515 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]Solution:当深度大于当前
2017-11-01 15:42:54 253
原创 LeetCode513
EX. 513 Given a binary tree, find the leftmost value in the last row of the tree. Example1: Input: 2 / \ 1 3Output:1 Example2: Input: 1 / \ 2 3 /
2017-11-01 15:35:10 204
原创 LeetCode343
EX.343 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
2017-10-18 15:05:50 220
原创 LeetCode357
LeetCode 357 Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example: Given n = 2, return 91. (The answer should be the total numbers in the range
2017-10-18 14:57:55 183
原创 LeetCode646
LeetCode 646 You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. Now, we define a pair (c, d) can follow another pair (a, b) if and only i
2017-10-12 17:10:27 163
原创 LeetCode 413
LeetCode 413 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 arit
2017-10-12 16:48:41 281
原创 LeetCode 338
LeetCode 338 Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array. Example
2017-10-09 13:30:36 214
原创 LeetCode Week5
LeetCode Week5EX.647 Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are counted as different sub
2017-10-08 16:13:20 179
原创 LeetCode Week4
LeetCode Week4EX.657 Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place. The move
2017-10-06 16:48:16 194
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人