Find the number Weak Connected Component in the directed graph. Each node in the graph contains a label and a list of its neighbors. (a connected set ...
分类:
其他好文 时间:
2015-09-01 21:12:12
阅读次数:
344
One pass in-place solution: all swaps.class Solution {public: /** * @param nums: a vector of integers * @return: nothing */ void partit...
分类:
其他好文 时间:
2015-08-29 15:20:27
阅读次数:
162
A variation to a classical DP: LCS.class Solution {public: /** * @param A an integer array * @return A list of integers includes the index o...
分类:
其他好文 时间:
2015-08-29 12:20:01
阅读次数:
145
1 /** 2 * class VersionControl { 3 * public: 4 * static bool isBadVersion(int k); 5 * } 6 * you can use VersionControl::isBadVersion(k) ...
分类:
其他好文 时间:
2015-08-28 10:56:53
阅读次数:
162
Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called 'serialization' and reading back f...
分类:
其他好文 时间:
2015-08-27 18:19:03
阅读次数:
142
Trapping Rain Water IIGivennxmnon-negative integers representing an elevation map 2d where the area of each cell is1x1, compute how much water it is a...
分类:
移动开发 时间:
2015-08-19 23:43:44
阅读次数:
500
给出一个整数数组nums和一个整数k。划分数组(即移动数组nums中的元素),使得:
所有小于k的元素移到左边
所有大于等于k的元素移到右边
返回数组划分的位置,即数组中第一个位置i,满足nums[i]大于等于k。
您在真实的面试中是否遇到过这个题?
Yes
样例
给出数组nums=[3,2,2,1]和 k=2,返回 1
注意
...
分类:
编程语言 时间:
2015-08-19 13:32:24
阅读次数:
185
Coins in a Line IIIThere arencoins in a line. Two players take turns to take a coin from one of the ends of the line until there are no more coins lef...
分类:
其他好文 时间:
2015-08-19 00:09:26
阅读次数:
247
下面是AC代码,C++风格: 1 class Solution { 2 public: 3 vector fizzBuzz(int N) { 4 vector Answer; 5 for(int i = 1;i <= N;i++) { 6 ...
分类:
其他好文 时间:
2015-08-18 01:01:23
阅读次数:
114
Determine the number of bits required to flip if you want to convert integernto integerm.ExampleGivenn=31(11111),m=14(01110), return2.NoteBothnandmare...
分类:
其他好文 时间:
2015-08-15 10:20:04
阅读次数:
127