2014年10月24日

摘要: Divide Two IntegersDivide two integers without using multiplication, division and mod operator.SOLUTION 11. 基本思想是不断地减掉除数,直到为0为止。但是这样会太慢。2. 我们可以使用2分法来加... 阅读全文
posted @ 2014-10-24 20:15 Yu's Garden 阅读(3235) 评论(1) 推荐(0) 编辑
摘要: Find Minimum in Rotated Sorted Array II Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-... 阅读全文
posted @ 2014-10-24 19:37 Yu's Garden 阅读(1840) 评论(0) 推荐(0) 编辑
摘要: Find Minimum in Rotated Sorted ArrayQuestion SolutionSuppose a sorted array is rotated at some pivot unknown to youbeforehand.(i.e., 0 1 2 4 5 6 7 mig... 阅读全文
posted @ 2014-10-24 18:37 Yu's Garden 阅读(2552) 评论(0) 推荐(0) 编辑
摘要: CandyThere are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the followin... 阅读全文
posted @ 2014-10-24 18:08 Yu's Garden 阅读(997) 评论(0) 推荐(0) 编辑
摘要: 引自:http://www.douban.com/note/330562764/注:此分类仅供大概参考,没有精雕细琢。有不同意见欢迎评论~利用堆栈:http://oj.leetcode.com/problems/evaluate-reverse-polish-notation/http://oj.l... 阅读全文
posted @ 2014-10-24 17:46 Yu's Garden 阅读(2163) 评论(1) 推荐(2) 编辑
摘要: Sort ColorsGiven an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the ... 阅读全文
posted @ 2014-10-24 16:39 Yu's Garden 阅读(932) 评论(0) 推荐(0) 编辑
摘要: Search for a RangeGiven a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity ... 阅读全文
posted @ 2014-10-24 12:40 Yu's Garden 阅读(2183) 评论(0) 推荐(1) 编辑
摘要: Spiral Matrix IIGiven an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should retu... 阅读全文
posted @ 2014-10-24 11:06 Yu's Garden 阅读(917) 评论(0) 推荐(0) 编辑
摘要: Set Matrix ZeroesGiven a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did yo... 阅读全文
posted @ 2014-10-24 09:44 Yu's Garden 阅读(565) 评论(0) 推荐(0) 编辑

导航