自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

浮生琴弦

ONE is all.

  • 博客(32)
  • 收藏
  • 关注

原创 LeetCode #229: Majority Element II

Problem Statement(Source) Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space.SolutionThis problems can be

2016-09-22 11:20:15 223

原创 LeetCode #169: Majority Element

Problem Statement(Source) 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 and th

2016-09-22 11:07:38 217

原创 LeetCode #32: Longest Valid Parentheses

Problem Statement(Source) Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses su

2016-09-21 18:54:20 222

原创 LeetCode #316: Remove Duplicate Letters

Problem Statement(Source) Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest i

2016-09-20 16:55:59 233

原创 LeetCode #377: Combination Sum IV

Problem Statement(Source) 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]

2016-09-20 16:10:07 534

原创 LeetCode #216: Combination Sum III

Problem Statement(Source) Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.E

2016-09-20 16:07:23 205

原创 LeetCode #40: Combination Sum II

Problem Statement(Source) Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used

2016-09-20 15:59:17 259

原创 LeetCode #39. Combination Sum

Problem Statement(Source) Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen fr

2016-09-20 15:54:16 184

原创 [TODO] LeetCode #300: Longest Increasing Subsequence

Problem Statement(Source) 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

2016-09-19 12:03:11 196

原创 LeetCode #318: Maximum Product of Word Lengths

Problem Statement(Source) 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 con

2016-09-19 11:51:42 212

原创 LeetCode #368: Largest Divisible Subset

Problem Statement(Source) 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

2016-09-18 22:49:16 249

原创 LeetCode #402: Remove K Digits

Problem StatementGiven a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible.Note:The length of num is less than 105 and w

2016-09-18 16:03:57 565

原创 LeetCode #403: Frog Jump

Problem Statement(Source) 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

2016-09-18 15:46:43 1065

原创 LeetCode #352: Data Stream as Disjoint Intervals

Problem Statement(Source) Given a data stream input of non-negative integers a1, a2, …, an, …, summarize the numbers seen so far as a list of disjoint intervals.For example, suppose the integers from t

2016-09-17 22:12:55 388

原创 LeetCode #57: Insert Interval

Problem Statement(Source) Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to th

2016-09-17 22:01:47 355

原创 LeetCode #56: Merge Intervals

Problem Statement(Source) Given a collection of intervals, merge all overlapping intervals.For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18].Solution# Definition for an inter

2016-09-17 21:43:44 189

原创 LeetCode #201: Bitwise AND of Numbers Range

Problem Statement(Source) Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.For example, given the range [5, 7], you should return 4.A

2016-09-17 17:24:19 200

原创 LeetCode #187: Repeated DNA Sequences

Problem Statement(Source) All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: “ACGAATTCCG”. When studying DNA, it is sometimes useful to identify repeated sequenc

2016-09-17 17:03:47 233

原创 LeetCode #162: Find Peak Element

Problem Statement(Source) A peak element is an element that is greater than its neighbours.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain m

2016-09-17 11:00:40 195

原创 LeetCode #153: Find Minimum in Rotated Sorted Array

Problem Statement(Source) Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate

2016-09-17 10:38:25 181

原创 LeetCode #167: Two Sum II - Input array is sorted

Problem Statement(Source) 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 indi

2016-09-16 17:35:10 207

原创 LeetCode #41: First Missing Positive

Problem Statement(Source) Given an unsorted integer array, find the first missing positive integer.For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2.Your algorithm should run in O(n) time

2016-09-13 13:14:39 218

原创 LeetCode #321: Create Maximum Number

Problem Statement(Source) Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum number of length k <= m + n from digits of the two. The relative order of the d

2016-09-07 11:48:36 341

原创 [TODO] LeetCode #363: Max Sum of Rectangle No Larger Than K

Problem Statement(Source) Given a non-empty 2D matrix matrix and an integer k, find the max sum of a rectangle in the matrix such that its sum is no larger than k.Example:Given matrix = [ [1, 0, 1]

2016-09-04 14:38:24 245

原创 LeetCode #10: Regular Expression Matching

Problem Statement(Source) Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cove

2016-09-04 12:45:36 221

原创 LeetCode #188: Best Time to Buy and Sell Stock IV

Problem Statement(Source) Say you have an array for which the ithi^{th} element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most k transac

2016-09-04 11:42:56 230

原创 LeetCode #87: Scramble String

Problem Statement(Source) Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = “great”: grea

2016-09-04 09:58:39 271

原创 [TODO] LeetCode #375: Guess Number Higher or Lower II

Problem Statement(Source) 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 th

2016-09-03 15:08:19 272

原创 LeetCode #388: Longest Absolute File Path

Problem Statement(Source) Suppose we abstract our file system by a string in the following manner:The string "dir\n\tsubdir1\n\tsubdir2\n\t\tfile.ext" represents:dir subdir1 subdir2 fil

2016-09-03 14:27:00 277

原创 LeetCode #140: Word Break II

Problem Statement(Source)Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For examp

2016-09-03 13:07:28 277

原创 LeetCode #233: Number of Digit One

Problem StatementGiven an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example: Given n = 13, Return 6, because digit 1 occurred in

2016-09-02 20:01:32 279

原创 LeetCode #273: Integer to English Words

Problem Statement(Source) Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231−12^{31} - 1.For example, 123 -> “One Hundred Twenty Three”

2016-09-02 14:59:24 255

空空如也

空空如也

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

TA关注的人

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