摘要:
Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"Corner Cases:Did you consider the case where path = "/../"?In this case, you should return "/".Another 阅读全文
posted @ 2013-08-02 22:36
冰点猎手
阅读(202)
评论(0)
推荐(0)
摘要:
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, white and blue.Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively.Note:You are not suppose to use the 阅读全文
posted @ 2013-08-02 20:16
冰点猎手
阅读(173)
评论(0)
推荐(0)
摘要:
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ]] class Solution {public: vector > generateMatrix(int n) { // Start typing your C/C++ soluti... 阅读全文
posted @ 2013-08-02 19:45
冰点猎手
阅读(179)
评论(0)
推荐(0)

浙公网安备 33010602011771号