[LeetCode] Spiral Matrix 解题报告

摘要: 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, ... 阅读全文
posted @ 2013-01-06 08:32 小刀初试 阅读(189) 评论(0) 推荐(0)

[LeetCode] Sort Colors 解题报告

摘要: Given 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 order red, ... 阅读全文
posted @ 2013-01-06 07:37 小刀初试 阅读(161) 评论(0) 推荐(0)

[LeetCode] Simplify Path 解题报告

摘要: Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"Corner Cases:Did y... 阅读全文
posted @ 2013-01-06 06:57 小刀初试 阅读(160) 评论(0) 推荐(0)

[LeetCode] Set Matrix Zeroes 解题报告

摘要: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up:Did you use extra space?A straight forward solu... 阅读全文
posted @ 2013-01-06 06:22 小刀初试 阅读(177) 评论(0) 推荐(0)