- 我的消息
- 我的博客
- 我的学院
- 我的下载
- 我的收藏
- 消息
-
-
Best Time to Buy and Sell Stock III - LeetCode 123
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 comp...
原创2015-10-10 15:41:094810 -
Perfect Squares - LeetCode 279
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 =...
原创2015-10-05 16:41:132530 -
Missing Number - LetcCode 268
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [...
原创2015-10-05 15:56:142660 -
Product of Array Except Self - LeetCode 238
Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums e...
原创2015-10-04 23:08:052130 -
Gas Station - LeetCode 134
There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it co...
原创2015-10-03 22:53:102250 -
3Sum Closest - LeetCode 16
题目描述: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three...
原创2015-06-28 11:32:402370 -
Summary Ranges - LeetCode 228
题目描述: Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2&qu...
原创2015-06-28 09:11:162790 -
Search in Rotated Sorted Array - LeetCode 33
题目描述: 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). You are given...
原创2015-06-27 11:25:452960 -
Basic Calculator II - LeetCode 227
题目描述: Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, +, -, *, / op...
原创2015-06-27 11:24:333470 -
Jump Game - LeetCode 55
题目描述: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents y...
原创2015-06-20 20:38:302600 -
First Missing Positive - LeetCode 41
题目描述: 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. ...
原创2015-06-20 19:12:112210 -
Median of Two Sorted Arrays - LeetCode 4
题目描述: 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 compl...
原创2015-06-20 17:42:062400 -
Path Sum II - LeetCode 113
题目描述: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary...
原创2015-06-20 11:30:162240 -
Sqrt(x) - LeetCode 69
题目描述: Implement int sqrt(int x). Compute and return the square root of x. Hide Tags Math Binary Search 分析:类型都是整型,直接二分 但是要注意处理非完全平方数。 /**/////...
原创2015-06-20 09:57:361940 -
Search for a Range - LeetCode 34
题目描述: Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be ...
原创2015-06-20 09:55:502780 -
Flatten Binary Tree to Linked List - LeetCode 114
题目描述: Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ ...
原创2015-06-15 20:29:111970 -
Sum Root to Leaf Numbers - LeetCode 129
题目描述: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1-&...
原创2015-06-13 22:10:402940 -
Sort List - LeetCode 148
题目描述 : Sort a linked list in O(n log n) time using constant space complexity. Hide Tags Linked List Sort 分析: 上一题是用插入排序,时间复杂度是O(N^2),这一题要求的时间复杂度只能...
原创2015-06-13 21:02:332520 -
Insertion Sort List - LeetCode 147
题目描述: Sort a linked list using insertion sort. Hide Tags Linked List Sort 分析: 插入排序是在一个已排序的序列中找到当前元素正确的位置,然后插入禁区即可。 由于链表不能随机访问,所以每处理一个元素时...
原创2015-06-12 22:24:412290 -
Bitwise AND of Numbers Range - LeetCode 201
题目描述: Given a range [m, n] where 0 For example, given the range [5, 7], you should return 4. Credits: Special thanks to @amrsaqr for adding th...
原创2015-06-12 21:04:542620
-
- 学院
- 下载
- 消息