随笔- 509
文章- 0
评论- 151
阅读-
22万
05 2014 档案
Careercup - Microsoft面试题 - 23123665
摘要:2014-05-12 07:44题目链接原题:Given an array having 16000 unique integers, each lying within the range 1 4 #include 5 using namespace std; 6 7 int main() 8...
阅读全文
Careercup - Microsoft面试题 - 24308662
摘要:2014-05-12 07:31题目链接原题:I have heard this question many times in microsoft interviews. Given two arrays find the intersection of those two arrays. Besi...
阅读全文
Careercup - Microsoft面试题 - 24313662
摘要:2014-05-12 07:27题目链接原题:Convert a base 2 number to a base 4 number题目:把二进制数转化成四进制数。解法:四是二的倍数,所以两位变一位就可以了。代码: 1 // http://www.careercup.com/question?id=2...
阅读全文
Careercup - Microsoft面试题 - 5799446021406720
摘要:2014-05-12 07:17题目链接原题:Given below is a tree/trie A B c D e F a>cd>> above string represents the following trie/tree (visualize) and assume that...
阅读全文
Careercup - Microsoft面试题 - 6751316000899072
摘要:2014-05-12 07:10题目链接原题:Write a thread safe data structure such that there could be only one writer at a time but there could be n readers reading the ...
阅读全文
Careercup - Microsoft面试题 - 5917873302142976
摘要:2014-05-12 06:56题目链接原题:A link list contains following elementsstruct node{ int data; node* next; node* random;}Given head of such a linked li...
阅读全文
Careercup - Microsoft面试题 - 4639756264669184
摘要:2014-05-12 06:42题目链接原题:Write your own regular expression parser for following condition: az*b can match any string that starts with and ends with b an...
阅读全文
Careercup - Microsoft面试题 - 5672369481842688
摘要:2014-05-12 06:27题目链接原题:Find the max height of a binary tree.题目:计算二叉树的最大高度。解法:最大高度?高度不就是最深的叶子节点到根节点的路径长度吗?我就当是高度吧,递归解决。代码: 1 // http://www.careercup.co...
阅读全文
Careercup - Microsoft面试题 - 5485521224597504
摘要:2014-05-12 06:19题目链接原题:Given an input list of lists.. flatten the list. For e.g. {{1,2}, {3}, {4,5}} ... Output should be {1, 2, 3, 4, 5}题目:给定一个二维数组,把...
阅读全文
Careercup - Microsoft面试题 - 5188169901277184
摘要:2014-05-12 06:12题目链接原题:Write a function to retrieve the number of a occurrences of a substring(even the reverse of a substring) in a string without us...
阅读全文
Careercup - Microsoft面试题 - 5700293077499904
摘要:2014-05-12 00:02题目链接原题:For a given map (ie Bing map) given longitude/latitude/ how would you design the system so that when map longitudeDelta/latitdu...
阅读全文
Careercup - Microsoft面试题 - 5204967652589568
摘要:2014-05-11 23:57题目链接原题:9 identical balls. one ball is heavy. find the heavy ball with only 2 measurements ........ dead easy.题目:9个看起来一样的球,其中有一个偏重。给定一个...
阅读全文
Careercup - Microsoft面试题 - 5175246478901248
摘要:2014-05-11 23:52题目链接原题:design an alarm clock for a deaf person.题目:为聋人设计闹钟?解法:聋人听不见,那么闪光、震动都可行。睡着的人也看不见光,所以震动应该是更靠谱的。个人觉得做成手表戴在手上的时候,才能保证震动有用。这样,睡觉的时候就...
阅读全文
Careercup - Microsoft面试题 - 5718181884723200
摘要:2014-05-11 05:55题目链接原题:difference between thread and process.题目:请描述进程和线程的区别。解法:操作系统理论题。标准答案在恐龙书上,我自己回忆了一点。我想就算是面试官也不会一字一句地要求你背书的,对于要点掌握住就可以了。代码: 1 // ...
阅读全文
Careercup - Microsoft面试题 - 6314866323226624
摘要:2014-05-11 05:29题目链接原题:Design remote controller for me.题目:设计一个遥控器。解法:遥控什么?什么遥控?传统的红外线信号吗?我只能随便说说思路吧。不知道这算什么类型的面试题,真遇到的话也算是倒了霉了。想了半天恍然大悟:原来是考察设计模式。查了相关...
阅读全文
Careercup - Microsoft面试题 - 5173689888800768
摘要:2014-05-11 05:21题目链接原题:Complexity of a function: int func_fibonacci ( int n) { if (n < 2) { return n; } else { return ( func_fibonacci(n-1) + func_fib...
阅读全文
Careercup - Microsoft面试题 - 6282862240202752
摘要:2014-05-11 03:56题目链接原题:Given an integer array. Perform circular right shift by n. Give the best solution.题目:给数组进行循环移位,给出最优解。解法:首先要考虑n的范围,对于负数和超过数组长度的数...
阅读全文
Careercup - Microsoft面试题 - 5428361417457664
摘要:2014-05-11 03:37题目链接原题:You have three jars filled with candies. One jar is filled with banana candies, one jar is filled with lemon candies and one ja...
阅读全文
Careercup - Microsoft面试题 - 6543214668414976
摘要:2014-05-11 02:56题目链接原题:Write a function called FooBar that takes input integer n and prints all the numbers from 1 upto n in a new line. If the number...
阅读全文
Careercup - Microsoft面试题 - 5684901156225024
摘要:2014-05-10 23:45题目链接原题:Arrange the numbers in an array in alternating order. For example if the array is [a1, a2, a3, a4.. ]arrange the array such tha...
阅读全文
Careercup - Microsoft面试题 - 5673934611546112
摘要:2014-05-10 23:26题目链接原题:what is the best,worst and average case complexity for fibonacci no.s ..explain?题目:计算斐波那契数的最好、最坏、平均复杂度是多少?解法:计算斐波那契数倒是有好多方法,不过平...
阅读全文
Careercup - Microsoft面试题 - 5120588943196160
摘要:2014-05-10 22:58题目链接原题:Three points are given A(x1, y1), B(x2, y2), C(x3, y3). Write a method returning an array of points (x, y) inside the triangle ...
阅读全文
Careercup - Microsoft面试题 - 6366101810184192
摘要:2014-05-10 22:30题目链接原题:Design database locks to allow r/w concurrency and data consistency.题目:设计一个支持并行读写并保证数据一致性的数据库锁。解法:这是什么范畴的面试题?对于我这种完全没有相关项目经验的人,...
阅读全文
Careercup - Microsoft面试题 - 5649647234187264
摘要:2014-05-10 22:17题目链接原题:A draw method is given, write a function to draw a chess board. The Draw method, draws a square and has parameters row positio...
阅读全文
Careercup - Microsoft面试题 - 5943729928011776
摘要:2014-05-10 21:56题目链接原题:Suppose you get number of unique users every second from bing For eg, 2,4,5,1,2,etc You need to write a web service method , su...
阅读全文
Careercup - Microsoft面试题 - 5752271719628800
摘要:2014-05-10 20:31题目链接原题:Given an array of integers and a length L, find a sub-array of length L such that the products of all integers are the biggest....
阅读全文
Careercup - Microsoft面试题 - 4840369632051200
摘要:2014-05-10 07:06题目链接原题:Suppose you have a collection of collection Eg : CEO-> Vps-> GMs ->.. CEO will contain collection of VP's, VP's will have colle...
阅读全文
Careercup - Microsoft面试题 - 5680049562845184
摘要:2014-05-10 06:51题目链接原题:"How would you find the number of gas stations in the United States?" *You cannot look up any concrete information (like the av...
阅读全文
Careercup - Microsoft面试题 - 6337018766295040
摘要:2014-05-10 06:38题目链接原题:What do you think is the next big thing in technology? For example, search engine is Google, social media is Facebook, etc. etc...
阅读全文
Careercup - Google面试题 - 5085331422445568
摘要:2014-05-08 23:45题目链接原题:How would you use Dijkstra's algorithm to solve travel salesman problem, which is to find a shortest path from a starting node ...
阅读全文
Careercup - Google面试题 - 5680330589601792
摘要:2014-05-08 23:18题目链接原题:If you have data coming in rapid succession what is the best way of dealing with redundant data?题目:如果你有大量数据流入,如何处理冗余数据?解法:又是“Gu...
阅读全文
Careercup - Google面试题 - 5424071030341632
摘要:2014-05-08 22:55题目链接原题:Given a list of strings. Produce a list of the longest common suffixes. If it asks for longest common substring, then building ...
阅读全文
Careercup - Google面试题 - 5377673471721472
摘要:2014-05-08 22:42题目链接原题:How would you split a search query across multiple machines?题目:如何把一个搜索query分发到多个机器上?解法:又是“Guy”出的题目。对query字符串算取数字签名,然后对集群的机器数量取模...
阅读全文
Careercup - Google面试题 - 6331648220069888
摘要:2014-05-08 22:27题目链接原题:What's the tracking algorithm of nearest location to some friends that are located in a grid region?题目:在一个格点坐标的地图里,如何追踪到一个朋友附近最...
阅读全文
Careercup - Google面试题 - 5692127791022080
摘要:2014-05-08 22:09题目链接原题:Implement a class to create timer object in OOP题目:用OOP思想设计一个计时器类。解法:我根据自己的思路,用clock()函数为工具,提供启动、停止、显示时长、重置四个方法。代码: 1 // http://...
阅读全文
Careercup - Google面试题 - 4847954317803520
摘要:2014-05-08 21:33题目链接原题:largest number that an int variable can fit given a memory of certain size题目:给定特定内存大小,请问int型的变量能表示的最大整数是多少?解法:这个“Guy”出的题目总是这样表意...
阅读全文
Careercup - Google面试题 - 5765091433644032
摘要:2014-05-08 09:32题目链接原题:Given a binary tree, how would you copy it from one machine to the other, assume you have a flash drive. I believe we should wr...
阅读全文
Careercup - Google面试题 - 5162732873580544
摘要:2014-05-08 08:26题目链接原题:Given a preorder traversal, create a binary search tree in optimized time题目:给定一个二叉搜索树的前序遍历,请重建这棵树。要求最优化算法。解法1:这人每次出题都要求“最优算法”,自...
阅读全文
Careercup - Google面试题 - 4877486110277632
摘要:2014-05-08 05:16题目链接原题:Given a circle with N defined points and a point M outside the circle, find the point that is closest to M among the set of N. ...
阅读全文
Careercup - Google面试题 - 6407924087783424
摘要:2014-05-07 15:17题目链接原题:Given an array of n elements (a1,a2,..ai,...,an). You are allow to chose any index i and j, such that (i!=j) and allow to perfo...
阅读全文
Careercup - Google面试题 - 5727310284062720
摘要:2014-05-06 14:04题目链接原题:given an 2D matrix M, is filled either using X or O, you need to find the region which is filled by O and surrounded by X and f...
阅读全文
Careercup - Google面试题 - 4699414551592960
摘要:2014-05-06 13:34题目链接原题:we have a random list of people. each person knows his own height and the number of tall people in front of him. write a code t...
阅读全文
Careercup - Google面试题 - 6271724635029504
摘要:2014-05-06 13:23题目链接原题:Finding a pair of elements from two sorted lists(or array) for which the sum of the elements is a certain value. Anyway solutio...
阅读全文
Careercup - Google面试题 - 6283958983589888
摘要:2014-05-06 11:31题目链接原题:Find the k-th Smallest Element in Two Sorted Arrays. I followed the algorithm from this post, http://leetcode.com/2011/01/find-...
阅读全文
Careercup - Google面试题 - 6332750214725632
摘要:2014-05-06 10:18题目链接原题:Given a set of intervals, find the interval which has the maximum number of intersections (not the length of a particular inter...
阅读全文
Careercup - Google面试题 - 5898529851572224
摘要:2014-05-06 07:56题目链接原题:Flatten an iterator of iterators in Java. If the input is [ [1,2], [3,[4,5]], 6], it should return [1,2,3,4,5,6]. Implement has...
阅读全文
Careercup - Google面试题 - 5634470967246848
摘要:2014-05-06 07:11题目链接原题:Find a shortest path in a N*N matrix maze from (0,0) to (N,N), assume 1 is passable, 0 is not, 3 is destination, use memorizati...
阅读全文
Careercup - Google面试题 - 5724823657381888
摘要:2014-05-06 06:37题目链接原题:Given an array of (unsorted) integers, arrange them such that a c e... etc.题目:给定一个无序的数组,调整元素顺序,使得数组满足a c e ... 这种形式。解法:这题没有...
阅读全文
Careercup - Google面试题 - 6253551042953216
摘要:2014-05-06 01:49题目链接原题:Modify the following code to add a row number for each line is printedpublic class Test { public static void main(String [] ...
阅读全文
Careercup - Google面试题 - 5661939564806144
摘要:2014-05-06 01:40题目链接原题:Give a N*N matrix, print it out diagonally. Follow up, if it is a M*N matrix, how to print it out. Example: 1 2 3 4 5 6 7 8 9 p...
阅读全文
Careercup - Google面试题 - 4807591515389952
摘要:2014-05-06 00:45题目链接原题:What would happen if you have only one server for a web cache (a web browser cache whose key is url and value is the loaded con...
阅读全文
Careercup - Google面试题 - 4716965625069568
摘要:2014-05-06 00:17题目链接原题:Given a 2-D matrix represents the room, obstacle and guard like the following (0 is room, B->obstacle, G-> Guard): 0 0 0 B G G ...
阅读全文
Careercup - Google面试题 - 4857362737266688
摘要:2014-05-04 00:10题目链接原题:Write a function return an integer that satisfies the following conditions: 1) positive integer 2) no repeated digits, eg., 123...
阅读全文
Careercup - Google面试题 - 5205167846719488
摘要:2014-05-03 23:35题目链接原题:For a given node in binary search tree find a next largest number in search tree.题目:给定一个二叉搜索树的节点,找出此节点在树中的中序后继节点,也就是比它大的最小节点。解法...
阅读全文
Careercup - Google面试题 - 5735304249999360
摘要:2014-05-03 23:18题目链接原题:Insert a element in a sorted circular linked list题目:题意简单明了,向一个有序的循环单向链表中插入元素,使得链表仍然有序。解法:由于是循环链表,所以表尾指向表头。链表只能顺序访问,不额外添加数据的情况下就...
阅读全文
Careercup - Google面试题 - 5732809947742208
摘要:2014-05-03 22:10题目链接原题:Given a dictionary, and a list of letters ( or consider as a string), find the longest word that only uses letters from the str...
阅读全文
Careercup - Google面试题 - 4557716425015296
摘要:2014-05-03 21:57题目链接原题:Many sticks with length, every time combine two, the cost is the sum of two sticks' length. Finally, it will become a stick, wh...
阅读全文
Careercup - Facebook面试题 - 6026101998485504
摘要:2014-05-02 10:47题目链接原题:1 Given an unordered array of positive integers, create an algorithm that makes sure no group of integers of size bigger than M...
阅读全文
Careercup - Facebook面试题 - 5344154741637120
摘要:2014-05-02 10:40题目链接原题:Sink Zero in Binary Tree. Swap zero value of a node with non-zero value of one of its descendants so that no node with value ze...
阅读全文
Careercup - Facebook面试题 - 5765850736885760
摘要:2014-05-02 10:07题目链接原题:Mapping '1' = 'A','B','C' '2' = 'D','E','F' ... '9' = input: 112 output :ouput = [AAD, BBD, CCD, AAE, AAF, BBE, BBF, CCE, CCF]题...
阅读全文
Careercup - Facebook面试题 - 5733320654585856
摘要:2014-05-02 09:59题目链接原题:Group Anagrams input = ["star, astr, car, rac, st"] output = [["star, astr"],["car","rac"],["st"]);题目:给定一堆字符串,设法把anagram都排在一起。解...
阅读全文
Careercup - Facebook面试题 - 4892713614835712
摘要:2014-05-02 09:54题目链接原题:You have two numbers decomposed in binary representation, write a function that sums them and returns the result. Input: 100011...
阅读全文
Careercup - Facebook面试题 - 6321181669982208
摘要:2014-05-02 09:40题目链接原题:Given a number N, write a program that returns all possible combinations of numbers that add up to N, as lists. (Exclude the N+...
阅读全文
Careercup - Facebook面试题 - 5177378863054848
摘要:2014-05-02 08:29题目链接原题:Write a function for retrieving the total number of substring palindromes. For example the input is 'abba' then the possible pa...
阅读全文
Careercup - Facebook面试题 - 4907555595747328
摘要:2014-05-02 07:49题目链接原题:Given a set of n points (coordinate in 2d plane) within a rectangular space, find out a line (ax+by=c), from which the sum of t...
阅读全文
Careercup - Facebook面试题 - 5435439490007040
摘要:2014-05-02 07:37题目链接原题:// merge sorted arrays 'a' and 'b', each with 'length' elements, // in-place into 'b' to form a sorted result. assume that 'b' ...
阅读全文
Careercup - Facebook面试题 - 5188884744896512
摘要:2014-05-02 07:18题目链接原题:boolean isBST(const Node* node) { // return true iff the tree with root 'node' is a binary search tree. // 'node' is guaranteed...
阅读全文
Careercup - Facebook面试题 - 5761467236220928
摘要:2014-05-02 07:06题目链接原题:Given an array of randomly sorted integers and an integer k, write a function which returns boolean True if a pair of numbers e...
阅读全文
Careercup - Facebook面试题 - 23869663
摘要:2014-05-02 03:37题目链接原题:A string is called sstring if it consists of lowercase english letters and no two of its consecutive characters are the same. Y...
阅读全文
Careercup - Facebook面试题 - 23594662
摘要:2014-05-02 03:19题目链接原题:Given a sequence of numbers A(1) ..A(n), find the continuous subsequenceA(i)..A(j) for which the sum of elements is maximum. co...
阅读全文
Careercup - Facebook面试题 - 6685828805820416
摘要:2014-05-02 02:33题目链接原题:Given the following 3 by 3 grid where the (first row, first column) is represented by (0,0): 0,1 1,2 3,3 1,1 3,3 3,2 3,0 1,3 nu...
阅读全文
Careercup - Facebook面试题 - 6204973461274624
摘要:2014-05-02 02:28题目链接原题:I/P: N, k O/P: all subset of N with exactly K elements. eg: I/p: N = 5, K =3 O/p: 1 2 3 1 2 4 1 2 5 1 3 4 1 3 5 2 3 4 2 3 5 3 4...
阅读全文
Careercup - Facebook面试题 - 5671785349513216
摘要:2014-05-02 01:05题目链接原题:bool anaStrStr (string needle, string haystack) {}Write a function that takes 2 strings , search returns true if any anagram of...
阅读全文
Careercup - Facebook面试题 - 5729456584916992
摘要:2014-05-02 00:59题目链接原题:Given a normal binary tree, write a function to serialize the tree into a string representation (returning the string), and als...
阅读全文
Careercup - Facebook面试题 - 4713484755402752
摘要:2014-05-02 00:30题目链接原题:Given two arrays of sorted integers, merge them keeping in mind that there might be common elements in the arrays and that comm...
阅读全文
Careercup - Facebook面试题 - 5998719358992384
摘要:2014-05-02 00:22题目链接原题:Given a matrix consisting of 0's and 1's, find the largest connected component consisting of 1's.题目:给定一个01矩阵,找出由1构成的连通分量中最大的一个。...
阅读全文
Careercup - Facebook面试题 - 5890898499993600
摘要:2014-05-01 02:30题目链接原题:Given a matrix of letters and a word, check if the word is present in the matrix. E,g., suppose matrix is: a b c d e f z n a b ...
阅读全文
Careercup - Facebook面试题 - 4922014007558144
摘要:2014-05-01 02:13题目链接原题:Design question: Say you have hacked in to a network and can deploy your bot thousands of machines, how would you design your b...
阅读全文
Careercup - Facebook面试题 - 6139456847347712
摘要:2014-05-01 01:50题目链接原题:Microsoft Excel numbers cells as 1...26 and after that AA, AB.... AAA, AAB...ZZZ and so on. Given a number, convert it to that ...
阅读全文
Careercup - Facebook面试题 - 5412018236424192
摘要:2014-05-01 01:32题目链接原题:Given a linked list where apart from the next pointer, every node also has a pointer named random which can point to any other ...
阅读全文
Careercup - Facebook面试题 - 4909367207919616
摘要:2014-05-01 01:23题目链接原题:WAP to modify the array such that arr[I] = arr[arr[I]]. Do this in place i.e. with out using additional memory. example : if a ...
阅读全文
Careercup - Facebook面试题 - 6299074475065344
摘要:2014-05-01 01:00题目链接原题:Given a matrix with 1's and 0's, a rectangle can be made with 1's. What is the maximum area of the rectangle. 00010 11100 11110...
阅读全文
Careercup - Facebook面试题 - 5179916190482432
摘要:2014-05-01 00:45题目链接原题:input [2,3,1,4] output [12,8,24,6] Multiply all fields except it's own position. Restrictions: 1. no use of division 2. complex...
阅读全文