2014-05-11 02:56 题目链接 原题: Write a function called FooBar that takes input integer n and prints all the numbers upto n then print then print and , print "FooBar". Otherwise just print the number. ) should print as follows: Foo Bar Foo Foo Bar Foo…
2014-05-11 05:29 题目链接 原题: Design remote controller for me. 题目:设计一个遥控器. 解法:遥控什么?什么遥控?传统的红外线信号吗?我只能随便说说思路吧.不知道这算什么类型的面试题,真遇到的话也算是倒了霉了.想了半天恍然大悟:原来是考察设计模式.查了相关资料后发现命令模式比较符合题意,所以就依葫芦画瓢写了个例子. 代码: // http://www.careercup.com/question?id=6366101810184192 int…
2014-05-10 22:30 题目链接 原题: Design database locks to allow r/w concurrency and data consistency. 题目:设计一个支持并行读写并保证数据一致性的数据库锁. 解法:这是什么范畴的面试题?对于我这种完全没有相关项目经验的人,还真是无从下手.翻了书之后顺便重新复习了一下共享锁.互斥锁的概念.说白了,这些都是课本上的基础知识,可是毕业没多久就忘光了.看来知识不用,保质期比水果还短.然后我琢磨着锁的模型,写了个模拟的…
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. Besides using hash table can we attain the same time complexity that is O(m+n) by using some other ap…
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/latitdueDelta changed you add additional pins on map for regions that was not previously cover. In anoth…
2014-05-11 23:57 题目链接 原题: identical balls. one ball measurements ........ dead easy. 题目:9个看起来一样的球,其中有一个偏重.给定一个不能给出具体重量,但可以比较轻重的天平,称2次找出那个重球. 解法:9个球三等分,称一次找出包含重球的那三个.3个球三等分,称一次找出重球. 代码: // http://www.careercup.com/question?id=5204967652589568 Answer:…
2014-05-11 23:52 题目链接 原题: design an alarm clock for a deaf person. 题目:为聋人设计闹钟? 解法:聋人听不见,那么闪光.震动都可行.睡着的人也看不见光,所以震动应该是更靠谱的.个人觉得做成手表戴在手上的时候,才能保证震动有用.这样,睡觉的时候就得戴着手表了. 代码: // http://www.careercup.com/question?id=5175246478901248 Answer: Deaf people can't…
2014-05-11 05:55 题目链接 原题: difference between thread and process. 题目:请描述进程和线程的区别. 解法:操作系统理论题.标准答案在恐龙书上,我自己回忆了一点.我想就算是面试官也不会一字一句地要求你背书的,对于要点掌握住就可以了. 代码: // http://www.careercup.com/question?id=5718181884723200 Answer: Process: . Basic element of resour…
2014-05-11 05:21 题目链接 原题: Complexity of a function: int func_fibonacci ( int n) { ) { return n; } else { ) + func_fibonacci(n-)); } } 题目:求上面函数的复杂度. 解法:时间复杂度就是斐波那契数,空间也是. 代码: // http://www.careercup.com/question?id=5173689888800768 /* T(0) = 1; T(1) =…
2014-05-11 03:56 题目链接 原题: Given an integer array. Perform circular right shift by n. Give the best solution. 题目:给数组进行循环移位,给出最优解. 解法:首先要考虑n的范围,对于负数和超过数组长度的数,先进行取模操作.然后用三次反转数组就可以完成循环移位. 代码: // http://www.careercup.com/question?id=6282862240202752 #incl…