- 博客(19)
- 收藏
- 关注
原创 利用推广的方法证明NP-完全性
8.10对下面每个问题,请通过证明它是本章某个NP-完全问题的推广说明它是NP-完全的。(a)子图同构:给定两个最为输入的无向图G和H,判断G是否为H的一个子图(即删除H中某些顶点或边后),所得到的新图最多只需修改某些定点的名称,即与G相同),且结果是,返回有V(G)和V(H)的相关映射。证明:令图G 为一个环,环上的顶点数等于图H 的顶点数。那么若G 是H 的同构子图,则说明H
2017-07-04 20:06:22
405
原创 Minimum Path Sum
题目:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right
2017-06-16 23:52:28
238
原创 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
2017-06-11 21:32:46
279
原创 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
2017-06-05 23:04:21
232
原创 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
2017-05-30 21:23:49
252
原创 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 arithmeti
2017-05-22 18:20:45
202
原创 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 adjacen
2017-05-14 15:27:40
283
原创 Predict the Winner
题目:Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player
2017-05-07 23:36:12
202
原创 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:4One possible lon
2017-05-02 12:42:39
323
原创 Minimum Number of Arrows to Burst Balloons
题目: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,
2017-04-23 10:16:07
407
原创 Queue Reconstruction by Height
题目:Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people
2017-04-16 18:39:35
244
原创 Most Frequent Subtree Su
题目: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 no
2017-04-08 14:06:26
270
原创 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
2017-04-04 18:42:21
607
原创 Minimum Time Difference
题目:Given a list of 24-hour clock time points in "Hour:Minutes" format, find the minimum minutes difference between any two time points in the list.Example 1:Input: ["23:59","00:00"]Output
2017-03-26 19:23:56
286
原创 Find Bottom Left Tree Value
题目:Given a binary tree, find the leftmost value in the last row of the tree.Example 1:Input: 2 / \ 1 3Output:1Example 2: Input: 1 / \
2017-03-18 16:36:25
485
原创 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-03-12 11:02:10
276
原创 Burst Balloons
题目: Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i you w
2017-03-04 11:09:40
374
原创 Find All Duplicates in an Array
Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements that appear twice in this array.Could you do it without ex
2017-02-25 19:39:05
243
原创 Max Consecutive Ones
Given a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last three digits are consecutiv
2017-02-25 15:47:23
334
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人