- 博客(25)
- 收藏
- 关注
原创 Leetcode 435. Non-overlapping Intervals
题目Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.Note: You may assume the interval’s end point is always big
2017-01-16 09:51:35 348
原创 Leetcode 329. Longest Increasing Path in a Matrix
-题目Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the answers. If the answer
2016-12-19 17:37:37 284
原创 [NPC] 证明EXACT 4SAT问题是NPC问题
-题目-8.8 在精确的4SAT(EXACT 4SAT)问题中,输入为一组字句,每个子句都是恰好4个文字的析取,且每个变量最多在子句中出现一次。目标是求他的满足赋值,如果该赋值存在,证明精确的4SAT问题是NP完全问题。-思路-这道题是比较简单的一题,按照书上所说的证明NPC问题的方法,我们只要把目前已知的NPC问题规约到精确的4SAT问题就可以证明精确的4SAT问题是NPC问题。那么根据精确4SA
2016-11-25 18:28:59 1075
原创 Leetcode 122. Best Time to Buy and Sell Stock II 题解
-题目- Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy
2016-11-05 13:40:44 361
原创 Leetcode 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
2016-11-05 13:01:46 237
原创 Leetcode 63. 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 g
2016-11-05 10:47:58 188
原创 Leetcode 368. Largest Divisible Subset
-题目Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or Sj % Si = 0. If there are multiple solutions,
2016-10-31 21:55:22 245
原创 Leetcode 375. Get Number Higher or Lower II
-题目We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I’ll tell you whether the number I picked is hi
2016-10-27 13:50:47 264
原创 Leetcode 376. Wiggle Subsequence
-题目A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either p
2016-10-26 22:16:16 165
转载 Leetcode 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],
2016-10-24 19:45:46 258
原创 Leetcode 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
2016-10-24 00:54:34 245
原创 Leetcode 62. Unique Paths
-题目A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the
2016-10-24 00:44:30 175
原创 Leetcode 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 trans
2016-10-22 10:44:54 211
原创 Leetcode 309. Best Time to Buy and Sell Stock with Cooldown
这道题初开始有一些不知所措,所以参考了一下网上的状态转移方程。题目Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transa
2016-10-22 09:50:06 238
原创 leetcode 312. 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 will
2016-10-22 09:33:51 370
原创 Leetcode 96. Unique Binary Search Trees
这个星期还是在讲dp算法,所以继续水一水dp相关的题目吧!第一题是非常非常简单的,因为题目长得比较像树型dp,但其实还是简单的dp经典题目。题目Given n, how many structurally unique BST’s (binary search trees) that store values 1…n? For example, Given n = 3, there are a
2016-10-22 01:07:52 173
原创 Leetcode 413. Arithmetic Slices
这题还是在锻炼使用dp的能力呢~,不过比前一篇博客的题目感觉上稍微简单一点~ -题目- 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.
2016-10-18 00:16:33 236
原创 Leetcode 416. Partition Equal Subset Sum
最近刚好学了动规思想,所以在leetcode找了两道dp的题目来学习并复习。这一道题难度是medium,使用的是一维的dp算法。 -题目- Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the su
2016-10-13 18:59:39 179
原创 Leetcode 64. 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
2016-10-13 18:49:53 212
原创 Leetcode 318. Maximum Product of Word Lengths
-题目- Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower case
2016-10-09 14:35:15 259
原创 Leetcode 319. Bulb Switcher
Bulb Switcher好久没更新博客啦,主要是因为都没刷到什么好题,这一篇也是大大的水题,不过因为思考的过程种发生了种种有(yu)趣(chun)的故事,姑且把它当作一篇娱乐向的博文来写233 不过,友情提示,前方卖蠢高能,看完你可能觉得又浪费了几分钟宝贵的时间233题目 There are n bulbs that are initially off. You first turn on
2016-10-09 09:27:05 213
原创 Leetcode--Single Number III
Single Number III题目Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.For exampl
2016-09-28 11:48:59 183
原创 Leetcode 240. Search a 2D Matrix II
这道题是同学问我的时候看到的,抱着solo的心态也做了一遍 第一次用的是二分和分治(刚好今晚老师也讲了分治) 然而效果好像不太佳? 先放一发题目: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:—Intege
2016-09-08 00:52:34 365
原创 167. Two Sum II - Input array is sorted
第二次刷题 这次的题目比第一次更简单欸PO一发题目:Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return ind
2016-09-06 19:22:27 156
原创 Leetcode 338.Counting Bits
Leetcode 338.Counting Bits第一次写博客各种一脸懵逼(:зゝ∠) 格式比较丑也懒得改了希望最好不要有同学戳进来! 根据老师大人的旨意我等渣渣要带着自己的渣代码出来丢人现眼了…这星期刷的题目比较水,随意从leetcode上medium难度的题挑了一道练练手题目如下: Given a non negative integer number num. For every nu
2016-09-03 22:30:30 278 3
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人