leetcode
weixin_36328753
这个作者很懒,什么都没留下…
展开
-
LeetCode Week3
LeetCode Week3原创 2017-09-24 20:38:55 · 159 阅读 · 0 评论 -
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 · 234 阅读 · 0 评论 -
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 · 171 阅读 · 0 评论 -
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 · 167 阅读 · 0 评论 -
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 · 304 阅读 · 0 评论 -
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 · 174 阅读 · 0 评论 -
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 · 205 阅读 · 0 评论 -
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 · 169 阅读 · 0 评论 -
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 · 138 阅读 · 0 评论 -
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 · 257 阅读 · 0 评论 -
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 · 143 阅读 · 0 评论 -
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 · 162 阅读 · 0 评论 -
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 · 188 阅读 · 0 评论 -
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 · 158 阅读 · 0 评论 -
LeetCode Week2
leedcode 1 12 15原创 2017-09-11 08:54:05 · 159 阅读 · 0 评论 -
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 · 142 阅读 · 0 评论