自定义博客皮肤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)
  • 收藏
  • 关注

原创 [LeetCode] 2 Keys Keyboard

题干: Initially on a notepad only one character ‘A’ is present. You can perform two operations on this notepad for each step: Copy All: You can copy all the characters present on the notepad (parti

2018-01-11 02:46:49 201

原创 [LeetCode] Ones and Zeroes

题干: In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue. For now, suppose you are a dominator of m 0s and n 1s respectively. On th

2018-01-11 02:28:07 229

原创 NP完全问题课后习题证明

这里证明课本课后习题8.10(a)令G为一个环,环上所有顶点数与H的顶点数相同,如果G是H的同构子图,那么H就包含了一条Rudrata回路,因此,Rudrata回路问题归约到了子图同构问题,因此,子图同构也是NP完全问题(b)令整数g = 图G顶点数 - 1,那么我们找到的就是一条Rudrata路径,因此,Rudrata路径问题归约到最长路径问题,最长路径问题也是NP完全问题

2018-01-10 23:49:46 1630

原创 [LeetCode] Maximum Product Subarray

题干: Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has the

2018-01-10 23:40:47 132

原创 [LeetCode] 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 the a

2018-01-10 22:56:49 132

原创 [LeetCode] 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

2018-01-10 22:26:27 95

原创 [LeetCode] Triangle

题干: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [2],

2018-01-10 14:30:39 380

原创 [LeetCode] Arithmetic Slices

题干: A zero-indexed array A consisting of N numbers is given. A slice of that array is any pair of integers (P, Q) such that 0 <= P < Q < N. A slice (P, Q) of array A is called arithmetic if the s

2017-12-17 23:58:51 113

原创 [LeetCode] Perfect Squares

题干: Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, …) which sum to n. For example, given n = 12, return 3 because 12 = 4 + 4 + 4; given n =

2017-12-10 23:59:45 114

原创 [LeetCode] Frog Jump

题干: A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water. Given a l

2017-12-03 22:04:23 138

原创 [LeetCode] Dungeon Game

题干: The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initial

2017-11-26 23:59:06 118

原创 [LeetCode] 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 s

2017-11-19 23:52:30 101

原创 [LeetCode] Unique Paths II

题干: Follow up for “Unique Paths”: Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the

2017-11-12 22:39:13 106

原创 [LeetCode] 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

2017-11-05 23:37:45 127

原创 [LeetCode] Jump Game II

题干: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your

2017-10-29 23:35:07 160

原创 [LeetCode] Jump Game

题干: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Deter

2017-10-23 22:57:47 174

原创 [LeetCode] 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: nu

2017-10-15 23:05:30 134

原创 [LeetCode] Search a 2D Matrix II

题干: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted in ascending from left to right. Intege

2017-09-24 23:50:43 148

原创 [LeetCode] 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

2017-09-17 22:23:54 130

原创 [LeetCode] Two Sum

[LeetCode] Two Sum

2017-09-10 23:15:19 103

空空如也

空空如也

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

TA关注的人

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