- 博客(36)
- 资源 (4)
- 收藏
- 关注
原创 LeetCode 494. Target Sum
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 sy
2017-05-31 17:15:29 243
原创 LeetCode 152. Maximum Product Subarray
152. Maximum Product Subarray最大连续乘积子序列(Maximum Product Subarray)1.问题描述 找一个数组里面,连续乘积最大的子序列,返回这个最大的乘积2.算法分析这道题其实很难,因为需要维护两个状态与状态转移方程跟前面的子序列问题一样,我们依旧用dp(i)来表示以i结尾的子序列。如果我们只维护最大值这个状态,那么当遇到负数的时候,就被舍弃了,
2017-05-31 16:05:52 233
原创 LeetCode 375. Guess Number Higher or Lower II
375. Guess 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
2017-05-29 16:48:22 422
原创 LeetCode 70. Climbing Stairs
70. Climbing Stairs一、问题描述 You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
2017-05-29 11:45:54 298
原创 LeetCode 198. House Robber
198. 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 th
2017-05-28 15:37:58 254
原创 LeetCode 303. Range Sum Query - Immutable
303. Range Sum Query - Immutable一、问题描述 Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Note: You may assume that the array does not
2017-05-28 00:10:31 269
原创 LeetCode 575. Distribute Candies
575. Distribute Candies一、问题描述 Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kin
2017-05-27 19:33:32 289
原创 LeetCode 438. Find All Anagrams in a String
438. Find All Anagrams in a String一、问题描述 Given a string s and a non-empty string p, find all the start indices of p’s anagrams in s. Strings consists of lowercase English letters only and the le
2017-05-27 19:13:40 895
原创 LeetCode 350. Intersection of Two Array
350. Intersection of Two Array一、问题描述 Given two arrays, write a function to compute their intersection. Note: Each element in the result should appear as many times as it shows in both ar
2017-05-27 12:52:49 362
原创 LeetCode 349. Intersection of Two Array
349. Intersection of Two Array一、问题描述 Given two arrays, write a function to compute their intersection. Note: Each element in the result must be unique. The result can be in any order.
2017-05-26 20:30:03 230
原创 LeetCode 409. Longest Palindrome
409. Longest Palindrome一、问题描述 Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This is case sensi
2017-05-26 19:57:24 299
原创 LeetCode 141. Linked List Cycle
141. Linked List Cycle一、问题描述 Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space?二、输入输出 有环 输出:true 无环 输出:false三、解题思路判断链表是否有
2017-05-26 19:03:31 282
原创 LeetCode 38. Count and Say
38. Count and Say一、问题描述 The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, … 1 is read off as “one 1” or 11. 11 is read off as “two 1s” or
2017-05-26 18:46:12 330
原创 LeetCode 581. Shortest Unsorted Continuous Subarray
581. Shortest Unsorted Continuous Subarray一、问题描述 Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be
2017-05-26 16:33:48 1116
原创 LeetCode 268. Missing Number
268. Missing Number一、问题描述 Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Note: Your algorithm should run in linear runti
2017-05-26 16:11:58 208
原创 LeetCode 167. Two Sum II - Input array is sorted
167. Two Sum II - Input array is sorted一、问题描述 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 functi
2017-05-26 16:11:30 199
原创 LeetCode 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-em
2017-05-26 14:26:23 184
原创 LeetCode 88. Merge Sorted Array
88. Merge Sorted Array一、问题描述 Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: You may assume that nums1 has enough space (size that is greate
2017-05-26 14:14:16 226
原创 LeetCode 189. Rotate Array
189. Rotate Array一、问题描述 Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Note: Try to co
2017-05-26 13:36:49 210
原创 LeetCode 119. Pascal's Triangle II
119. Pascal’s Triangle II一、问题描述 Given an index k, return the *k*th row of the Pascal’s triangle. Could you optimize your algorithm to use only O(k) extra space?二、输入输出For example, given k = 3,
2017-05-26 12:54:41 322
原创 LeetCode 118. Pascal's Triangle
118. Pascal’s Triangle一、问题描述 Given numRows, generate the first numRows of Pascal’s triangle.二、输入输出For example, given numRows = 5, Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]
2017-05-26 11:30:54 223
原创 LeetCode 217. Contains Duplicate
217. Contains Duplicate Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should r
2017-05-26 11:27:05 191
原创 LeetCode 53. Maximum Subarray
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],
2017-05-25 15:41:55 203
原创 LeetCode 122. Best Time to Buy and Sell Stock II
122. Best Time to Buy and Sell Stock II Say you have an array for which the i*th element is the price of a given stock on day *i. Design an algorithm to find the maximum profit.
2017-05-23 10:41:02 254
原创 LeetCode 121. Best Time to Buy and Sell Stock
121. Best Time to Buy and Sell Stock Say you have an array for which the i*th element is the price of a given stock on day *i.
2017-05-22 22:51:56 552
原创 LeetCode 35. Search Insert Position
35. Search Insert Position Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
2017-05-22 22:30:42 168
原创 LeetCode 485. Max Consecutive Ones
485. Max Consecutive Ones Given a binary array, find the maximum number of consecutive 1s in this array.
2017-05-22 22:10:46 388
原创 LeetCode 448. Find All Numbers Disappeared in an Array
448. Find All Numbers Disappeared in an Array Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.
2017-05-22 21:56:16 185
原创 LeetCode 442. Find All Duplicates in an Array
**442. 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.
2017-05-22 21:53:11 240
原创 LeetCode 27. Remove Element
27. Remove Element Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you must do this in pla
2017-05-22 20:40:28 173
原创 LeetCode 532. K-diff Pairs in an Array
532. K-diff Pairs in an Array Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i,
2017-05-22 20:39:48 270
原创 LeetCode 476. Number Complement
476. Number Complement Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.
2017-05-22 16:29:01 443
原创 LeetCode 13.Roman to Integer
13.Roman to Integer Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.解题思路罗马数字大部分都是在加,有个特殊情况是减当左边的数字小于右边的数字,且为IXC之一的时候就要减去这个数字
2017-05-22 16:28:10 332
原创 LeetCode 566.Reshape the Matrix
566.Reshape the Matrix In MATLAB, there is a very useful function called ‘reshape’, which can reshape a matrix into a new one with different size but keep its original data.
2017-05-22 16:27:09 311
原创 LeetCode 219.Contains Duplicate II
219.Contains Duplicate II Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j]*and the **absolute differ
2017-05-22 16:26:04 174
原创 LeetCode 66.Plus One
66.Plus One一、问题描述 Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any leading zero, except the number
2017-05-22 15:03:52 255
Linux内核完全剖析基于0.12内核.pdf (附linux kernel 0.12源码和测试软件,亲测可用)
2017-06-02
json所需的全部jar包(共7个-亲测可用)
2015-10-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人