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 ...
分类:
其他好文 时间:
2016-04-06 07:06:09
阅读次数:
159
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 ...
分类:
其他好文 时间:
2016-04-06 07:06:05
阅读次数:
163
Given an absolute path for a file (Unix-style), simplify it. Example "/home/", => "/home" "/a/./b/../../c/", => "/c" "/home/", => "/home" "/a/./b/../. ...
分类:
其他好文 时间:
2016-04-06 07:05:45
阅读次数:
139
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] ...
分类:
其他好文 时间:
2016-04-06 07:02:44
阅读次数:
175
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target va ...
分类:
其他好文 时间:
2016-04-05 19:50:13
阅读次数:
144
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 ...
分类:
其他好文 时间:
2016-04-05 19:47:13
阅读次数:
172
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 ...
分类:
其他好文 时间:
2016-04-05 19:19:49
阅读次数:
135
Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a functio ...
分类:
其他好文 时间:
2016-04-05 19:16:24
阅读次数:
124
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 ...
分类:
其他好文 时间:
2016-04-05 19:15:20
阅读次数:
134
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 ...
分类:
其他好文 时间:
2016-04-05 19:13:58
阅读次数:
143