Chinaunix首页 | 论坛 | 博客
  • 博客访问: 269983
  • 博文数量: 170
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1709
  • 用 户 组: 普通用户
  • 注册时间: 2014-05-06 18:01
文章分类

全部博文(170)

文章存档

2016年(11)

2015年(130)

2014年(29)

发布时间:2015-03-15 10:43:01

Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]You should return [1,2,3,6,9,8,7,4,5].public static List<Integer> spiralOrder(int[][] matr.........【阅读全文】

阅读(230) | 评论(0) | 转发(0)

发布时间:2015-03-07 11:10:30

Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlimited number of times.Note:All numbers (including target) will .........【阅读全文】

阅读(347) | 评论(0) | 转发(0)

发布时间:2015-03-05 09:16:01

Write a function to find the longest common prefix string amongst an array of strings.public class LongestCommonPrefix {public String longestCommonPrefix(String[] strs) {if(strs.length==0)return "";String tempString=strs[0];    for (int i = 1; i < strs.length; i++) {   i.........【阅读全文】

阅读(676) | 评论(0) | 转发(0)

发布时间:2015-01-30 12:35:29

Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is pretty straight forward. Could you devise a constant space solution?二叉排序树中有两个节点被交换了,要求把树恢复成二叉排序树。中序遍历二叉树生.........【阅读全文】

阅读(798) | 评论(0) | 转发(0)

发布时间:2015-01-29 12:39:56

/You are given an n x n 2D matrix representing an image.////Rotate the image by 90 degrees (clockwise).////Follow up://Could you do this in-place?矩阵旋转问题:先对正对角线轴对称,在对垂直最中间的线轴对称。public class RotateImage {public void rotate(int[][] matrix) {int row=matrix.length.........【阅读全文】

阅读(800) | 评论(0) | 转发(0)
给主人留下些什么吧!~~
留言热议
请登录后留言。

登录 注册