上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 22 下一页
摘要: Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and al... 阅读全文
posted @ 2014-05-11 23:27 一弦一仙 阅读(190) 评论(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-05-11 20:34 一弦一仙 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Spiral MatrixGiven a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[... 阅读全文
posted @ 2014-05-11 20:23 一弦一仙 阅读(142) 评论(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?思路:先将矩阵转置,然后将第一列与最后... 阅读全文
posted @ 2014-05-11 18:57 一弦一仙 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,3],... 阅读全文
posted @ 2014-05-11 17:10 一弦一仙 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le... 阅读全文
posted @ 2014-05-11 16:04 一弦一仙 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o... 阅读全文
posted @ 2014-05-11 15:50 一弦一仙 阅读(128) 评论(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-05-11 15:05 一弦一仙 阅读(105) 评论(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-05-11 14:41 一弦一仙 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list using insertion sort.//用到O(N)的额外空间public class Solution { public ListNode insertionSortList(ListNode head) { if(head==nul... 阅读全文
posted @ 2014-05-11 12:58 一弦一仙 阅读(150) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 22 下一页