上一页 1 2 3 4 5 6 ··· 8 下一页
摘要: Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l... 阅读全文
posted @ 2014-06-22 11:10 Averill Zheng 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ... 阅读全文
posted @ 2014-06-22 07:05 Averill Zheng 阅读(171) 评论(0) 推荐(0) 编辑
摘要: There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requi... 阅读全文
posted @ 2014-06-21 23:39 Averill Zheng 阅读(115) 评论(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?A s... 阅读全文
posted @ 2014-06-16 07:45 Averill Zheng 阅读(108) 评论(0) 推荐(0) 编辑
摘要: You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?public class Soluti... 阅读全文
posted @ 2014-06-16 06:57 Averill Zheng 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matri... 阅读全文
posted @ 2014-06-16 05:55 Averill Zheng 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ],... 阅读全文
posted @ 2014-06-16 05:34 Averill Zheng 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Validate if a given string is numeric.Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>trueNote:It is intended for the problem stat... 阅读全文
posted @ 2014-06-16 03:17 Averill Zheng 阅读(90) 评论(0) 推荐(0) 编辑
摘要: The set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie... 阅读全文
posted @ 2014-06-14 21:36 Averill Zheng 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i... 阅读全文
posted @ 2014-06-14 00:10 Averill Zheng 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No... 阅读全文
posted @ 2014-06-13 23:43 Averill Zheng 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially... 阅读全文
posted @ 2014-06-13 21:10 Averill Zheng 阅读(169) 评论(0) 推荐(0) 编辑
摘要: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possibl... 阅读全文
posted @ 2014-06-13 12:35 Averill Zheng 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t... 阅读全文
posted @ 2014-06-13 03:02 Averill Zheng 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].public class S... 阅读全文
posted @ 2014-06-13 02:12 Averill Zheng 阅读(201) 评论(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 ord... 阅读全文
posted @ 2014-06-12 04:26 Averill Zheng 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Pana... 阅读全文
posted @ 2014-06-12 02:02 Averill Zheng 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n... 阅读全文
posted @ 2014-06-12 01:10 Averill Zheng 阅读(166) 评论(0) 推荐(0) 编辑
摘要: The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11is read off as"tw... 阅读全文
posted @ 2014-06-10 02:31 Averill Zheng 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi... 阅读全文
posted @ 2014-06-09 23:26 Averill Zheng 阅读(167) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 8 下一页