- 博客(21)
- 收藏
- 关注
转载 书 8.10 8.12 8.14 8.15
8.10 a) 令图G为一个环,环上的顶点数等于图H的顶点数。那么若G是H的同构子 图,则说明 H 存在 Rudrata 回路。于是知 Rudrata 回路事实上是子图同构问题的 一个特例。 b) 如果令 g = V −1,即得到一条 Rudrata 路径。 c) 令g为子句的总数,即成SAT。 d) 令b= a(a−1),此时这a个顶点两两相连,于是即成最大团问题。 2 e)
2017-07-07 00:11:05 215
转载 书8.8
在精确的4SAT问题中,输入为一组子句,每个子句都是恰好四个文字的析取,且每个变量最多在每个子句中出现一次,目标是求他的满足赋值,如果该赋值i存在,证明精确的4SAT是NP完全问题 首先很显然,EXACT 4SAT属于NP。现在通过将3SAT归约到EXACT 4SAT来证 明后者的 NP 完全性。对于任意一个 3SAT 实例,如果其中某个子句中包含了同一个 文字多次,那么可以缩减
2017-07-07 00:04:46 142
转载 300. Longest Increasing Subsequence
Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest increasing subsequence is [2, 3, 7, 101], ther
2017-07-06 23:24:17 161
转载 454. 4Sum II
Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero. To make problem a bit easier, all A, B, C, D have same len
2017-07-06 23:23:06 149
转载 486. Predict the Winner
Given an array of scores that arenon-negative integers. Player 1 picks one of the numbers from either end of thearray followed by the player 2 and then player 1 and so on. Each time a playerpicks a nu
2017-07-06 23:21:27 177
转载 523. Continuous Subarray Sum
Given a listof non-negative numbers and a target integer k,write a function to check if the array has a continuous subarray of size atleast 2 that sums up to the multiple of k, that is, sums up to n
2017-07-06 23:19:42 141
转载 350. Intersection of Two Arrays II
Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each element in the result should appear as many times as it shows in both arrays.The result can be in any order.
2017-06-12 19:57:57 123
转载 524. Longest Word in Dictionary through Deleting
Given a string and a string dictionary, find the longest string in the dictionary that can be formed by deleting some characters of the given string. If there are more than one possible results, retur
2017-06-12 19:31:49 175
转载 494. Target Sum
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 out
2017-05-22 13:09:51 193
转载 516. Longest Palindromic Subsequence
Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000. Example 1: Input: "bbbab" Output: 4 One possible longest palind
2017-05-15 14:24:44 154
转载 508. Most Frequent Subtree Sum
Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values formed by the subtree rooted at that node (includi
2017-05-01 13:02:56 216
转载 513. Find Bottom Left Tree Value
层序遍历,保存每层的第一个值,最后的即为所求值。 class Solution { public: int findBottomLeftValue(TreeNode* root) { int result = root->val; queue q; q.push(root); TreeNode* temp;
2017-04-24 18:12:54 158
转载 515. Find Largest Value in Each Tree Row
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] 题目的意思很简洁明了,就是找出树的每
2017-04-16 21:44:31 206
转载 394. Decode String
Given an encoded string, return it's decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is
2017-04-10 14:14:44 153
转载 543. Diameter of Binary Tree
Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longestpath between any two nodes in a tree. This path may or may no
2017-04-03 11:17:01 223
转载 503. Next Greater Element II
Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The Next Greater Number of a number x is the first gre
2017-03-27 14:35:32 179
转载 496. Next Greater Element I
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums
2017-03-27 14:02:47 190
转载 53. Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1]
2017-03-20 14:27:06 122
转载 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-12 23:07:10 155
转载 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
2017-03-05 22:17:08 134
转载 Add Two Numbers
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-23 17:22:12 146
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人