摘要: Given an integer matrix, find a submatrix where the sum of numbers is zero. Your code should return the coordinate of the left-up and right-down numbe 阅读全文
posted @ 2016-04-06 18:34 哥布林工程师 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Given an integer array, find a subarray with sum closest to zero. Return the indexes of the first number and last number. Example Given [-3, 1, 1, -3, 阅读全文
posted @ 2016-04-06 12:43 哥布林工程师 阅读(150) 评论(0) 推荐(0) 编辑
摘要: Given an integer n, generate a square matrix filled with elements from 1 to n^2 in spiral order. Example Given n = 3, You should return the following 阅读全文
posted @ 2016-04-06 12:15 哥布林工程师 阅读(97) 评论(0) 推荐(0) 编辑
摘要: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Example Given the following matrix: [ [ 1, 2, 阅读全文
posted @ 2016-04-06 10:36 哥布林工程师 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list in O(n log n) time using constant space complexity. Example Given 1-3->2->null, sort it to 1->2->3->null. /** * Definition for List 阅读全文
posted @ 2016-04-06 07:53 哥布林工程师 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Given a string which contains only letters. Sort it by lower case first and upper case second. Notice It's NOT necessary to keep the original order of 阅读全文
posted @ 2016-04-06 07:35 哥布林工程师 阅读(218) 评论(0) 推荐(0) 编辑
摘要: Given an array of n objects with k different colors (numbered from 1 to k), sort them so that objects of the same color are adjacent, with the colors 阅读全文
posted @ 2016-04-06 07:26 哥布林工程师 阅读(125) 评论(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, 阅读全文
posted @ 2016-04-06 06:48 哥布林工程师 阅读(128) 评论(0) 推荐(0) 编辑
摘要: Given 2*n + 2 numbers, every numbers occurs twice except two, find them. Example Given [1,2,2,3,4,4,5,3] return 1 and 5 Given [1,2,2,3,4,4,5,3] return 阅读全文
posted @ 2016-04-06 05:47 哥布林工程师 阅读(142) 评论(0) 推荐(0) 编辑
摘要: Given 3*n + 1 numbers, every numbers occurs triple times except one, find it. Example Given [1,1,2,3,3,3,2,2,4,1] return 4 Given [1,1,2,3,3,3,2,2,4,1] 阅读全文
posted @ 2016-04-06 03:36 哥布林工程师 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Given an absolute path for a file (Unix-style), simplify it. Example "/home/", => "/home" "/a/./b/../../c/", => "/c" "/home/", => "/home" "/a/./b/../. 阅读全文
posted @ 2016-04-06 03:18 哥布林工程师 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. Example Given a matrix [ [1,2], [0,3] ], return[[0,2],[0 阅读全文
posted @ 2016-04-06 02:46 哥布林工程师 阅读(148) 评论(0) 推荐(0) 编辑