LeetCode
匍匐前进的小菜鸟
这个作者很懒,什么都没留下…
展开
-
Leetcode374. Guess Number Higher or Lower
题目描述: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 is higher or原创 2016-11-28 18:04:33 · 171 阅读 · 0 评论 -
LeetCode Binary Search
LeetCode Binary Search首先开始Binary Search系列的学习,这个系列的习题主要是考察二分查找的这一类题往往有相同的特征。例如:题目会给定一段有序的序列在题目中会出现例如first或者last这样的字眼又或者题目会让我们在O(logn)的时间内完成又或者题目要求我们在一段范围内之间寻找目标元素对于Binary Search这类题,其实做起来并不困难,困难的是怎么原创 2016-11-24 19:47:52 · 274 阅读 · 0 评论 -
Leetcode35. 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.You may assume no duplicates in the array.原创 2016-12-03 16:01:18 · 292 阅读 · 0 评论 -
Leetcode74. Search a 2D Matrix
题目描述:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each ro原创 2016-11-30 14:52:39 · 167 阅读 · 0 评论 -
Leetcode34. 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 in t原创 2016-11-30 16:05:35 · 169 阅读 · 0 评论 -
Leetcode69. Sqrt(x)
题目描述:Implement int sqrt(int x).Compute and return the square root of x.题目要求:要求我们求取x的平方根题目分析:本题与之前的Arranging Coins那道题很相似,都是可以使用一般的迭代方法O(n)的时间复杂度,和二分法O(logn)的时间复杂度http://blog.csdn.net/qq_27896185/article原创 2016-11-30 14:15:21 · 187 阅读 · 0 评论 -
Leetcode441. Arranging Coins
题目描述:You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins.Given n, find the total number of full staircase rows that can be formed.n is原创 2016-11-30 13:21:17 · 186 阅读 · 0 评论 -
Leetcode278. First Bad Version
题目描述:You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on原创 2016-11-28 21:44:30 · 189 阅读 · 0 评论 -
Leetcode350. Intersection of Two Arrays II
题目描述:Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].Note:Each element in the result should appear as many times as原创 2016-11-28 21:30:03 · 146 阅读 · 0 评论 -
Leetcode349. Intersection of Two Arrays
349. Intersection of Two Arrays题目描述:Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note:Each element in the result mus原创 2016-11-28 20:24:10 · 189 阅读 · 0 评论 -
Leetcode 412.Fizz Buzz
题目描述:Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”.原创 2016-11-28 18:16:53 · 257 阅读 · 0 评论 -
Leetcode 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?题目含义:共有n层的楼梯,你每次只能走一节或者两节的楼梯,那么问原创 2016-11-28 14:11:46 · 241 阅读 · 0 评论