上一页 1 2 3 4 5 6 7 ··· 23 下一页
摘要: 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) 编辑
摘要: For an array, we can build a SegmentTree for it, each node stores an extra attributecount to denote the number of elements in the the array which valu 阅读全文
posted @ 2016-04-05 17:58 哥布林工程师 阅读(187) 评论(0) 推荐(0) 编辑
摘要: For an integer array (index from 0 to n-1, where n is the size of this array), in the corresponding SegmentTree, each node stores an extra attribute m 阅读全文
posted @ 2016-04-05 17:55 哥布林工程师 阅读(152) 评论(0) 推荐(0) 编辑
摘要: For a Maximum Segment Tree, which each node has an extra value max to store the maximum value in this node's interval. Implement a modify function wit 阅读全文
posted @ 2016-04-05 17:54 哥布林工程师 阅读(147) 评论(0) 推荐(0) 编辑
摘要: The structure of Segment Tree is a binary tree which each node has two attributesstart and end denote an segment / interval. start and end are both in 阅读全文
posted @ 2016-04-05 17:52 哥布林工程师 阅读(114) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 23 下一页