![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
championlinguiyi
这个作者很懒,什么都没留下…
展开
-
[leetcode] Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not found原创 2014-02-21 10:15:27 · 331 阅读 · 0 评论 -
[leetcode]Search Insert Position
用二分查找的思想注意最后返回的left right 会出错class Solution {public: int searchInsert(int A[], int n, int target) { int left=0; int right=n-1; while(left<=right){ int mid=原创 2014-02-24 10:14:56 · 397 阅读 · 0 评论 -
[leetcode]Valid Sudoku
Valid Sudoku Total Accepted: 4716 Total Submissions: 17442My SubmissionsDetermine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially f原创 2014-02-25 11:01:12 · 460 阅读 · 0 评论 -
[leetcode]Sudoku Solver
Sudoku Solver Total Accepted: 4129 Total Submissions: 20589My SubmissionsWrite a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character原创 2014-02-27 09:45:29 · 499 阅读 · 0 评论 -
[leetcode]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" or11.11 is read off as "two 1s" or 21.21 is read off as "on原创 2014-02-28 10:13:20 · 371 阅读 · 0 评论 -
[leetcode]First Missing Positive
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 and uses constant spa原创 2014-03-05 11:11:33 · 386 阅读 · 0 评论 -
[leetcode]Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1]原创 2014-03-06 10:49:46 · 331 阅读 · 0 评论 -
[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 goal i原创 2014-03-31 10:54:24 · 284 阅读 · 0 评论 -
[leetcode]Permutations
Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1].全排列问题,本题不考虑重复原创 2014-04-02 10:49:11 · 265 阅读 · 0 评论