自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(20)
  • 收藏
  • 关注

原创 作业8.3

可知STINGY SAT 的解是可以在多项式时间内验证的,所以它属于 NP。而且,可以通过将 k 设为所有变量的总个数,将 SAT 归约到 STINGY SAT,最终可知 STINGY SAT 为 NP 完全问题

2017-12-29 13:08:07 133

原创 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 how many

2017-12-24 13:08:28 113

原创 486. 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 picks

2017-12-24 12:25:14 134

原创 19. Remove Nth Node From End of List

题目Given a linked list, remove the nth node from the end of list and return its head.For example,Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the linked list

2017-12-24 11:22:27 131

原创 740. Delete and Earn

题目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 equal ...

2017-12-24 10:59:00 122

原创 746. Min Cost Climbing Stairs

题目On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed).Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of t

2017-12-24 10:20:28 161

原创 712. Minimum ASCII Delete Sum for Two Strings

题目Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal.Example 1: Input: s1 = “sea”, s2 = “eat” Output: 231 Explanation: Deleting “s” from “sea” adds t

2017-12-09 19:59:31 89

原创 714. Best Time to Buy and Sell Stock with Transaction Fee

题目Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee.You may complete as many t

2017-12-04 01:24:35 107

原创 718. Maximum Length of Repeated Subarray

题目Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.Example 1: Input: A: [1,2,3,2,1] B: [3,2,1,4,7] Output: 3 Explanation: The repeated subar

2017-12-04 00:48:07 96

原创 121. Best Time to Buy and Sell Stock

题目Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), de

2017-11-29 23:06:12 109

原创 647. Palindromic Substrings

题目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 substrings even they consist o

2017-11-29 22:33:16 97

原创 406. 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 in front of this

2017-11-18 19:52:12 116

原创 455. Assign Cookies

题目Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a co

2017-11-18 16:37:25 122

原创 207. Course Schedule

题目There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pai

2017-10-30 22:34:06 152

原创 684. Redundant Connection

题目内容In this problem, a tree is an undirected graph that is connected and has no cycles.The given input is a graph that started as a tree with N nodes (with distinct values 1, 2, …, N), with one additio

2017-10-14 14:22:28 125

原创 4. Median of Two Sorted Arrays

题目There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Example 1: nums1 = [1, 3] n

2017-10-07 15:42:24 184

原创 100. Same Tree

题目Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.思路分析要判断两个树是否结构相同,

2017-09-26 18:12:59 114

原创 257. Binary Tree Paths

问题描述Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree:1 / \ 2 3 \ 5 All root-to-leaf paths are:思路分析稍后再写代码/** * Definition for a binary tree

2017-09-26 17:41:05 107

原创 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] h

2017-09-19 22:08:43 209

原创 169. Majority Element 分治解法

169. Majority Element 解法问题论述Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty an

2017-09-12 20:06:54 962

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除