摘要: 题目:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not poss... 阅读全文
posted @ 2016-01-07 22:48 很好玩 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 题目:Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted arraynums=[1,1,1,2,2,3],Your function should... 阅读全文
posted @ 2016-01-07 22:01 很好玩 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 题目:You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).思路:方法一:可以见矩阵看成多个环组成,如下4*4的矩阵包括两个环,第一个环为1,2,3,4,8,12,1... 阅读全文
posted @ 2016-01-07 21:51 很好玩 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 题目:Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted fro... 阅读全文
posted @ 2016-01-07 17:19 很好玩 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 题目: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 ... 阅读全文
posted @ 2016-01-07 16:30 很好玩 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 题目: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... 阅读全文
posted @ 2016-01-07 16:08 很好玩 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 题目:Given amxnmatrix, 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 you use extra space?... 阅读全文
posted @ 2016-01-07 11:31 很好玩 阅读(214) 评论(0) 推荐(0) 编辑