<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>阅微堂 &#187; 面试题</title>
	<atom:link href="http://zhiqiang.org/blog/tag/%e9%9d%a2%e8%af%95%e9%a2%98/feed" rel="self" type="application/rss+xml" />
	<link>http://zhiqiang.org/blog</link>
	<description>理工科背景的证券从业人员</description>
	<lastBuildDate>Sun, 05 Feb 2012 03:59:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>毛毛虫爬棍子面试题</title>
		<link>http://zhiqiang.org/blog/science/a-brain-teaser-microsoft.html</link>
		<comments>http://zhiqiang.org/blog/science/a-brain-teaser-microsoft.html#comments</comments>
		<pubDate>Thu, 03 Nov 2011 12:36:07 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[自然科学]]></category>
		<category><![CDATA[IQ]]></category>
		<category><![CDATA[面试题]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/?p=2549</guid>
		<description><![CDATA[博客 » 自然科学 » 面试题 » 系列：面试题 查看该系列所有文章 1. 一列士兵横排站开，军官第一秒喊口令"about face"，然后士兵有的会左转有的会右转，这样转完后一些士兵会面对面，然后下一秒这些面对面的士兵会向后转。再下一秒仍是如此。问最后会不会结束。证明。如果能结束的话所花时间的上界。 答案：会结束。时间上限为人数。 2. 上题事实上是下面这个题目的升级...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/science">自然科学</a> » <a href='http://zhiqiang.org/blog/tag/%e9%9d%a2%e8%af%95%e9%a2%98'>面试题</a>  » </p><div class="series"><span>系列：<b>面试题</b></span><br/>
<a href="http://zhiqiang.org/blog/tag/%e9%9d%a2%e8%af%95%e9%a2%98">查看该系列所有文章</a>
<div id='series'></div>
</div>  <p>1.</p>
<p>一列士兵横排站开，军官第一秒喊口令"about face"，然后士兵有的会左转有的会右转，这样转完后一些士兵会面对面，然后下一秒这些面对面的士兵会向后转。再下一秒仍是如此。问最后会不会结束。证明。如果能结束的话所花时间的上界。</p>
<p>答案：会结束。时间上限为人数。</p>
<p>2.</p>
<p>上题事实上是下面这个题目的升级版：</p>
<p>从天上随机掉下来10只毛毛虫到一根1米长的棍子上，落下后毛毛虫随机往棍子两头爬。每条毛毛虫每次碰到其它毛毛虫就掉头爬，直到掉下棍子为止。假设所有毛毛虫爬行速度一样，为每秒钟一厘米。问多少时间后毛毛虫全都掉下来？</p>
<p>答案：100。</p>
<p>3.</p>
<p>再来个第2题的升级版：</p>
<p>同上题，1米长的棍子收尾相连变成一个圈。问是否存在某个时刻，所有毛毛虫都回到初始位置和初始方向？如果存在，求时间上界。</p>
<p>答案：会；时间上限为1000。</p>
<div><h4>相关文章</h4><ul><li><a href="http://zhiqiang.org/blog/science/a-small-game-intuitive-and-theoretical-paradox.html">小游戏中直觉和理论的悖论</a></li><li><a href="http://zhiqiang.org/blog/memopad/a-similar-points-of-the-pirates-answer.html">一个类似海盗分金的推断题</a></li><li><a href="http://zhiqiang.org/blog/science/to-active-the-brain-active.html">来活跃活跃大脑</a></li><li><a href="http://zhiqiang.org/blog/science/small-investment.html">投资小问题</a></li><li><a href="http://zhiqiang.org/blog/it/test-age-of-your-brain.html">快来测试你的脑年龄</a></li><li><a href="http://zhiqiang.org/blog/science/googles-crazy-face-questions.html">Google的疯狂面试题</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/another-perfect-shuffle-algorithm.html">Perfect Shuffle的算法</a></li><li><a href="http://zhiqiang.org/blog/it/emc-2008-10-writing-test.html">2008年10月EMC笔试</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/163-written-test-problems.html">网易笔试题</a></li><li><a href="http://zhiqiang.org/blog/science/worldquant-written-test-2007.html">WorldQuant的笔试题</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2011. | <a href="http://zhiqiang.org/blog/science/a-brain-teaser-microsoft.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/science/a-brain-teaser-microsoft.html#comments">15 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/science/a-brain-teaser-microsoft.html/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>WorldQuant的笔试题</title>
		<link>http://zhiqiang.org/blog/science/worldquant-written-test-2007.html</link>
		<comments>http://zhiqiang.org/blog/science/worldquant-written-test-2007.html#comments</comments>
		<pubDate>Wed, 26 Nov 2008 11:07:58 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[自然科学]]></category>
		<category><![CDATA[worldquant]]></category>
		<category><![CDATA[面试题]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/posts/worldquant-written-test-2007.html</guid>
		<description><![CDATA[博客 » 自然科学 » 面试题 » 系列：面试题 查看该系列所有文章 今年找工作并且常在水木混的人对WorldQuant这个公司应该不陌生，因为它在各求职版周期性发帖，标题是“美国著名对冲基金！&#160;&#160; 超百万收入！！！”，而且中英文轮流上，让人不注意也难。 WorldQuant的笔试以难度注明，考试时间也超长，5个小时以上，绝对是智力和体力的双重挑战。 今年这次校园招聘马...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/science">自然科学</a> » <a href='http://zhiqiang.org/blog/tag/%e9%9d%a2%e8%af%95%e9%a2%98'>面试题</a>  » </p><div class="series"><span>系列：<b>面试题</b></span><br/>
<a href="http://zhiqiang.org/blog/tag/%e9%9d%a2%e8%af%95%e9%a2%98">查看该系列所有文章</a>
<div id='series'></div>
</div>  <p>今年找工作并且常在水木混的人对WorldQuant这个公司应该不陌生，因为它在各求职版周期性发帖，标题是“美国著名对冲基金！&#160;&#160; 超百万收入！！！”，而且中英文轮流上，让人不注意也难。</p>
<p>WorldQuant的笔试以难度注明，考试时间也超长，5个小时以上，绝对是智力和体力的双重挑战。</p>
<p>今年这次校园招聘马上就要开始了。先贴一个网上找到的去年的WorldQuant笔试题（好像去年才进入中国，所以也只有这么一次的样本）。大家先热身一下。</p>
<p>300层楼，3个一样的小球，设计一个策略，得到小球摔碎的临界层数，并且要求最坏情况下所试次数最少。</p>
<blockquote><p>经典的扔鸡蛋问题，只不过现在有三个鸡蛋。解题思路一样的，都是动态规划。</p>
<p>记F(n, k)为n层楼，k个球时所需要的最少尝试次数，则</p>
<p>F(n, k) = min ( F(n-r, k) + 1, F(r-1, k-1) + 1), r = 1, 2, …, n;</p>
<p>F(n, 1) = n;</p>
</blockquote>
<p>一百个眼镜，摆成一个圈，全部正面向上，第一个人将每个翻动一次，一共翻了100次；第二个人从no.2开始隔一个翻一次，也翻100次；第3个人从no.3开始隔两个翻一次，翻100次，问100个人之后，多少眼镜正面向上</p>
<blockquote><p>以前有个类似的题目说的是眼镜在一个直线上，现在这个版本要难一些。</p>
<p>对序号为<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_9dd4e461268c8034f5c8564e155c67a6.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="x" /></span><script type='math/tex'>x</script> (<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_1adde790267df49ea780c0b800fcc45d.gif' style='vertical-align: middle; border: none; ' class='tex' alt="x=1,2,\cdots, 100" /></span><script type='math/tex'>x=1,2,\cdots, 100</script>)的眼镜，如果<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_58d5a19ef9d27ecf1d451691f51b6baa.gif' style='vertical-align: middle; border: none; ' class='tex' alt="(100,i)|x" /></span><script type='math/tex'>(100,i)|x</script>，它在第<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_865c0c0b4ab0e063e5caa3387c1a8741.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="i" /></span><script type='math/tex'>i</script>轮翻动的次数为<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_5dd37563bb5253f714ec246bae58d355.gif' style='vertical-align: middle; border: none; ' class='tex' alt="(100, i)" /></span><script type='math/tex'>(100, i)</script>，否则没有被翻动。所以它总共被翻动的次数为</p>
<p><p style='text-align:center;'><span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_95475fad7de375c0fd7b654fd4202218.gif' style='vertical-align: middle; border: none;' class='tex' alt="\sum\limits_{(i,100)|x} (100, i) = \sum\limits_{d|(x,100)} d\varphi(\frac{100}{d})" /></span><script type='math/tex; mode=display'>\sum\limits_{(i,100)|x} (100, i) = \sum\limits_{d|(x,100)} d\varphi(\frac{100}{d})</script></p></p>
<p>其中这里<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_1f5cbb651d2e47ef5a245797a854dee4.gif' style='vertical-align: middle; border: none; ' class='tex' alt="\varphi(z)" /></span><script type='math/tex'>\varphi(z)</script>为1到<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_fbade9e36a3f36d3d676c1b808451dd7.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="z" /></span><script type='math/tex'>z</script>中与<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_fbade9e36a3f36d3d676c1b808451dd7.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="z" /></span><script type='math/tex'>z</script>互素的数的个数。注意到上面式子右边要么<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_8277e0910d750195b448797616e091ad.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="d" /></span><script type='math/tex'>d</script>为偶数，要么<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_2f9edb36d7ce247c7a60147c702dd79c.gif' style='vertical-align: middle; border: none; ' class='tex' alt="\varphi(\frac{100}{d})" /></span><script type='math/tex'>\varphi(\frac{100}{d})</script>为偶数，所以所有眼镜都被翻动偶数次，从而最后所有眼镜都是正面朝上的。</p>
</blockquote>
<p>一个蛋糕，切成连续的n块，有m个豆，问如果每小块上放一种豆，并且要求相邻的2块上的豆不一样，有多少种方法。</p>
<blockquote><p>？？？</p>
</blockquote>
<p>一条东西向长街，你站在街中间，街北是一排门，你有一把钥匙，请写出一种策略，要求X/N在最坏情况下最少，X为你到达正确的门时所走的总路程，N为正确的门距原点的距离，可以假设门与门之间距离为1。</p>
<blockquote><p>动态规划？</p>
</blockquote>
<p>都不怎么会做 <img src='http://zhiqiang.org/blog/wp-includes/images/smilies/sad.gif' alt=':(' class='wp-smiley' /> </p>
<div><h4>相关文章</h4><ul><li><a href="http://zhiqiang.org/blog/science/computer-science/an-algorithm-face-interviews-question-test.html">一个算法面试题 &#038; 面试题库</a></li><li><a href="http://zhiqiang.org/blog/science/game-two-hats.html">帽子游戏二</a></li><li><a href="http://zhiqiang.org/blog/science/googles-crazy-face-questions.html">Google的疯狂面试题</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/another-perfect-shuffle-algorithm.html">Perfect Shuffle的算法</a></li><li><a href="http://zhiqiang.org/blog/it/emc-2008-10-writing-test.html">2008年10月EMC笔试</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/163-written-test-problems.html">网易笔试题</a></li><li><a href="http://zhiqiang.org/blog/science/a-brain-teaser-microsoft.html">毛毛虫爬棍子面试题</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2008. | <a href="http://zhiqiang.org/blog/science/worldquant-written-test-2007.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/science/worldquant-written-test-2007.html#comments">21 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/science/worldquant-written-test-2007.html/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>网易笔试题</title>
		<link>http://zhiqiang.org/blog/science/computer-science/163-written-test-problems.html</link>
		<comments>http://zhiqiang.org/blog/science/computer-science/163-written-test-problems.html#comments</comments>
		<pubDate>Thu, 30 Oct 2008 04:58:21 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[计算机科学]]></category>
		<category><![CDATA[有道]]></category>
		<category><![CDATA[网易]]></category>
		<category><![CDATA[面试题]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/?p=870</guid>
		<description><![CDATA[博客 » 计算机科学 » 面试题 » 系列：面试题 查看该系列所有文章 笔试多了，便会发现题目大同小异，很多笔试考的时候就是考经验和见世面。下面收集一些。 Fibonacci数列中，一个Fibonacci数如果与它之前的Fibonacci数均互质，则称为Fibonacci质数。第一个Fibonacci质数为2，第二个为3，第三个为5。。。(Fibonacci数列为1, 1, 2, 3, 5, ...)。输入一个数K，则第K个Fibonacci质数所对应的序数是...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/science/computer-science">计算机科学</a> » <a href='http://zhiqiang.org/blog/tag/%e9%9d%a2%e8%af%95%e9%a2%98'>面试题</a>  » </p><div class="series"><span>系列：<b>面试题</b></span><br/>
<a href="http://zhiqiang.org/blog/tag/%e9%9d%a2%e8%af%95%e9%a2%98">查看该系列所有文章</a>
<div id='series'></div>
</div>  <p>笔试多了，便会发现题目大同小异，很多笔试考的时候就是考经验和见世面。下面收集一些。</p>
<p>Fibonacci数列中，一个Fibonacci数如果与它之前的Fibonacci数均互质，则称为Fibonacci质数。第一个Fibonacci质数为2，第二个为3，第三个为5。。。(Fibonacci数列为1, 1, 2, 3, 5, ...)。输入一个数K，则第K个Fibonacci质数所对应的序数是多少？</p>
<blockquote><p><span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_b4d77ec3e184ad9485636d597ccfffba.gif' style='vertical-align: middle; border: none; ' class='tex' alt="F(0)=0, F(1)=1, F(2)=1, F(3)=2, F(4)=3, F(n+2)=F(n+1)+F(n)" /></span><script type='math/tex'>F(0)=0, F(1)=1, F(2)=1, F(3)=2, F(4)=3, F(n+2)=F(n+1)+F(n)</script></p>
<p>定理：<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_3edf343eff7df866768b791b1d92aa05.gif' style='vertical-align: middle; border: none; ' class='tex' alt="(F(n), F(m)) = F((n,m))" /></span><script type='math/tex'>(F(n), F(m)) = F((n,m))</script></p>
<p>所以<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_616689e1da200035e42c847af789d4bb.gif' style='vertical-align: middle; border: none; ' class='tex' alt="F(n)" /></span><script type='math/tex'>F(n)</script>为Fibonacci质数当且仅当<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_7b8b965ad4bca0e41ab51de7b31363a1.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="n" /></span><script type='math/tex'>n</script>为质数或者4。</p>
</blockquote>
<p>求极限lim(x-[x])，x趋于-3。</p>
<blockquote><p>极限不存在。没想到网易还考这玩意儿。</p>
</blockquote>
<p>编程题：输入一个正整数，若该数能用几个连续正整数之和表示，则输出所有可能的正整数序列。</p>
<blockquote><p>利用高斯求和公式，n+(n+1)+…+m = (n+m)(m-n+1)/2。</p>
</blockquote>
<p>new/delete和malloc/free的区别，并说说你在什么情况下会自另行建立自己的内存分配机制。</p>
<blockquote><p>malloc和free不知道构造函数和析构函数</p>
<p>malloc/free:只要给出想要的内存的长度就分配,并返加(void*)</p>
<p>new/delete:分配内存同时进行类型检测,内置了sizeof运算,如果分配类的话,自动调用类的构造函数,delete也是,释放内存时调类的析构</p>
<p>为什么有必要写自己的operator new和operator delete？</p>
<p>答案通常是：为了效率。缺省的operator new和operator delete具有非常好的通用性，它的这种灵活性也使得在某些特定的场合下，可以进一步改善它的性能。尤其在那些需要动态分配大量的但很小的对象的应用程序里，情况更是如此。</p>
<p>有这样一个方法来实现你的自定义的operator new：先让缺省operator new分配一些大块的原始内存，每块的大小都足以容纳很多个airplane对象。</p>
</blockquote>
<p>有两个字符串str1和str2，写一个函数实现在str1中查找str2的初始位置。要求不区分大小写。</p>
<blockquote><p>KMP算法？</p>
</blockquote>
<p>在字符串S中寻找最长的字符串x，条件是xx存在于S中。即是如：abcabcdcd中的abc。</p>
<p>有100个真币和一个假币，只知道真币与假币不等重，要求只称两次，得出是真币重还是假币重。</p>
<blockquote><p>101个钱币中，任取一个，其余100个分为2份，如果重量相同，取出的必定假币，与任何一个真币比较即可。如果重量不等，把重的50枚分为两分，如果不等，则假币重，否则假币轻。</p>
</blockquote>
<p>有<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_a1ba37088b3ed9531c2788e0be9210ff.gif' style='vertical-align: middle; border: none; ' class='tex' alt="b_1/a_1,b_2/a_2,\cdots,b_n/a_n" /></span><script type='math/tex'>b_1/a_1,b_2/a_2,\cdots,b_n/a_n</script>共<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_7b8b965ad4bca0e41ab51de7b31363a1.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="n" /></span><script type='math/tex'>n</script>个分数，分母同号，证明：<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_eccc44b928d2c9cdc62d55addddbad9c.gif' style='vertical-align: middle; border: none; ' class='tex' alt=" (b_1+b_2+\cdots+bn)/(a_1+a_2+\cdots+a_n)" /></span><script type='math/tex'> (b_1+b_2+\cdots+bn)/(a_1+a_2+\cdots+a_n)</script>的值在上面<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_7b8b965ad4bca0e41ab51de7b31363a1.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="n" /></span><script type='math/tex'>n</script>个分数值最大制和最小值之间．</p>
<blockquote><p>数学归纳法</p>
</blockquote>
<p>证明题：在三角形中，假设等角对等边，证明大角对大边。</p>
<p>问答题：为什么现在的计算机采用二进制？而不是八进制或十六进制？你认为以后的计算机会采用几进制？</p>
<p>程序设计题：有篇文章，找出文章中单词在词典中的序号，要求高效率．词典没排序．</p>
<blockquote><p>HASH？</p>
</blockquote>
<p>一个没有拷贝构造函数和重载＝运算符的Ｓtring类，会出现什么问题，如何解决？</p>
<blockquote><p>拷贝时将进行按位拷贝。指针地址而不是内容直接被拷贝，同一块内存可能被多个对象引用，可能在删除后被另一个对象再次调用，或者多次被删除。</p>
</blockquote>
<p>有一位警长，抓了三个逃犯。现警长决定给他们一次机会。他拿出3顶黑帽子，两顶白帽子，然后往这三个逃犯头上每人戴了一顶帽子，每个逃犯只能看到另外两个逃犯帽子的颜色，不能看到自己帽子的颜色，而且不能进行通讯，不能进行讨论，只能靠自己的推理推出来，如果猜出来了，放一条生路，否则处死。</p>
<p>警长先问第一逃犯，结果第一逃犯猜错了，被杀掉了。</p>
<p>警长问第二个逃犯，结果还是猜错了，同样被杀掉了。</p>
<p>警长再问第三个逃犯，结果第三个逃犯猜对了。</p>
<p>说明一下，每个逃犯在回答问题时，其他逃犯是听不到的。</p>
<p>为什么第三个一定能猜中，请你给出解释。</p>
<blockquote><p>如果A看到另外两个人都带白色帽子，那么自己肯定带黑色帽子。</p>
<p>如果A看到另外两个帽子一白一黑，而黑色帽子的那个人死了（一白一黑都死了），那么自己肯定不是白帽子，而是黑帽子。</p>
<p>如果A看到另外两个帽子都是黑色的，而第二个黑帽子也死了（如果A带白帽子，那么地一个黑帽子死了，第二个黑帽子应该知道自己帽子的颜色），那么A肯定不是带白帽子，而是带黑帽子。</p>
</blockquote>
<div><h4>相关文章</h4><ul><li><a href="http://zhiqiang.org/blog/science/computer-science/an-algorithm-face-interviews-question-test.html">一个算法面试题 &#038; 面试题库</a></li><li><a href="http://zhiqiang.org/blog/science/game-two-hats.html">帽子游戏二</a></li><li><a href="http://zhiqiang.org/blog/science/googles-crazy-face-questions.html">Google的疯狂面试题</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/another-perfect-shuffle-algorithm.html">Perfect Shuffle的算法</a></li><li><a href="http://zhiqiang.org/blog/it/emc-2008-10-writing-test.html">2008年10月EMC笔试</a></li><li><a href="http://zhiqiang.org/blog/science/worldquant-written-test-2007.html">WorldQuant的笔试题</a></li><li><a href="http://zhiqiang.org/blog/science/a-brain-teaser-microsoft.html">毛毛虫爬棍子面试题</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2008. | <a href="http://zhiqiang.org/blog/science/computer-science/163-written-test-problems.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/science/computer-science/163-written-test-problems.html#comments">28 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/science/computer-science/163-written-test-problems.html/feed</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>2008年10月EMC笔试</title>
		<link>http://zhiqiang.org/blog/it/emc-2008-10-writing-test.html</link>
		<comments>http://zhiqiang.org/blog/it/emc-2008-10-writing-test.html#comments</comments>
		<pubDate>Sat, 25 Oct 2008 15:56:13 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[IT技术]]></category>
		<category><![CDATA[EMC]]></category>
		<category><![CDATA[面试题]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/?p=863</guid>
		<description><![CDATA[博客 » IT技术 » 面试题 » 系列：面试题 查看该系列所有文章 今天下午去EMC笔试了。笔试题目分四部分：求职意向3题，专业基础知识和智力题25道，编程题3道，英语作文。全英文题目和作答。虽然前面关于操作系统，网络协议，C++的题目我大多都不会，但就后面那些数学和智力题而言，我觉得它们的题目出得非常好。考试时居然没签保密协定，所以我可以在这里随意透露题...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/it">IT技术</a> » <a href='http://zhiqiang.org/blog/tag/%e9%9d%a2%e8%af%95%e9%a2%98'>面试题</a>  » </p><div class="series"><span>系列：<b>面试题</b></span><br/>
<a href="http://zhiqiang.org/blog/tag/%e9%9d%a2%e8%af%95%e9%a2%98">查看该系列所有文章</a>
<div id='series'></div>
</div>  <p>今天下午去EMC笔试了。笔试题目分四部分：求职意向3题，专业基础知识和智力题25道，编程题3道，英语作文。全英文题目和作答。虽然前面关于操作系统，网络协议，C++的题目我大多都不会，但就后面那些数学和智力题而言，我觉得它们的题目出得非常好。考试时居然没签保密协定，所以我可以在这里随意透露题目</p>
<p>下面有些内容由留言区网友提供，不一一指出。</p>
<p><span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_22406d7d1ba229b26335931434245d83.gif' style='vertical-align: middle; border: none; ' class='tex' alt="97^{59}" /></span><script type='math/tex'>97^{59}</script>除以59的余数是多少。</p>
<blockquote><p>答案是38，这个题目考费马小定理；不过直接硬算也可以。</p></blockquote>
<p>int a=1000000000, b=2000000000; a=a+b;b=a-b;a=a-b; 最后a，b是多少？</p>
<blockquote><p>正常交换。</p></blockquote>
<p>如何判别一个数是unsigned</p>
<blockquote><p>我选了 a&gt;=0 &amp;&amp; -a&gt;=0；但据说正确答案是 a&gt;=0 &amp;&amp; ~a&gt;=0</p></blockquote>
<p>100层楼，两个鸡蛋。某层之上扔鸡蛋就会碎。问至少要测试多少次才能试出这个层数。</p>
<blockquote><p>动态规划，答案是14。这个问题讨论很多了。</p>
<p>具体方法是先从14楼开始抛第一次；如果没碎，再从27楼抛第二次；如果还没碎，再从39楼抛第三次；如果还没碎，再从50 楼抛第四次；如此，每次间隔的楼层少一层。这样，任何一次抛棋子碎时，都能确保最多抛14次可以找出临界楼层。</p></blockquote>
<p>25匹马，每次比赛可选5匹马赛出次序（无法计时）。问至少要比赛多少次才能确定跑得最快，次快和第三快的三匹马。</p>
<blockquote><p>7次。首先分为5组，每组进行一次比赛，然后每组的头一名共五匹马比赛一次。假设第一组快于第二组快于第三组依次。最后一次安排第一组的二三名和第二组的一二名和第三组的第一名。</p></blockquote>
<p>上台阶，每次可走一台阶和两台阶，问上10个台阶有多少种走法</p>
<blockquote><p>斐波那契数列。答案89</p></blockquote>
<p>A、B、C三个瓶子，A瓶子是空的，B瓶子里有1个白球1个黑球，C瓶子里有1000个白球和1280个黑球。现在蒙着眼睛从C瓶子里取两个球放到A瓶子里。分两个阶段从三个瓶子中摸球（每次摸球后放回再摸下一次），摸到白球赢55000美元，摸到黑球什么也得不到也不损失什么。问为了使两次的收益最大，应该采取什么策略？</p>
<blockquote><p>算了一下答案应该是两次都在B里面拿。</p>
<p>我又挂了一个题。</p></blockquote>
<p>大题1：插入一个节点到一个有序链表。</p>
<p>大题2：循环的有序数组（比如1，2，3，4，5，-3，-2，-1这种数列）里查找一个数</p>
<p>大题3：在一个正整数序列中求和最大的非相邻子序列（序列任两元素在原序列里都不相邻）</p>
<p>还有好多题，忘了，想起来了再加。</p>
<p>做完了才发现判卷时先看小题，小题过了才判大题。大题也太简单。估计挂了 <img title="{#emotions_dlg.crying.gif}" src="http://zhiqiang.org/blog/wp-includes/js/tinymce/plugins/emotions/img/crying.gif" alt="{#emotions_dlg.crying.gif}" border="0" /></p>
<div><h4>相关文章</h4><ul><li><a href="http://zhiqiang.org/blog/science/computer-science/an-algorithm-face-interviews-question-test.html">一个算法面试题 &#038; 面试题库</a></li><li><a href="http://zhiqiang.org/blog/science/game-two-hats.html">帽子游戏二</a></li><li><a href="http://zhiqiang.org/blog/science/googles-crazy-face-questions.html">Google的疯狂面试题</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/another-perfect-shuffle-algorithm.html">Perfect Shuffle的算法</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/163-written-test-problems.html">网易笔试题</a></li><li><a href="http://zhiqiang.org/blog/science/worldquant-written-test-2007.html">WorldQuant的笔试题</a></li><li><a href="http://zhiqiang.org/blog/science/a-brain-teaser-microsoft.html">毛毛虫爬棍子面试题</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2008. | <a href="http://zhiqiang.org/blog/it/emc-2008-10-writing-test.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/it/emc-2008-10-writing-test.html#comments">49 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/it/emc-2008-10-writing-test.html/feed</wfw:commentRss>
		<slash:comments>49</slash:comments>
		</item>
		<item>
		<title>Perfect Shuffle的算法</title>
		<link>http://zhiqiang.org/blog/science/computer-science/another-perfect-shuffle-algorithm.html</link>
		<comments>http://zhiqiang.org/blog/science/computer-science/another-perfect-shuffle-algorithm.html#comments</comments>
		<pubDate>Tue, 01 Apr 2008 00:35:27 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[计算机科学]]></category>
		<category><![CDATA[memo]]></category>
		<category><![CDATA[perfect shuffle]]></category>
		<category><![CDATA[算法]]></category>
		<category><![CDATA[面试题]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/posts/perfect-shuffle%e7%9a%84%e7%ae%97%e6%b3%95.html</guid>
		<description><![CDATA[博客 » 计算机科学 » 算法 » 系列：面试题 查看该系列所有文章 珍爱生命，远离政治。我们继续讨论算法。 2008/04/01补充：此算法有重大缺陷。详情请见留言部分。 一年前，我们讨论过一个算法问题，perfect shuffle，据称是个微软面试题： 输入，如何用的时间，的空间，将这个序列顺序改为。 那一次讨论我们翻出了问题的来源，一篇长达12页的论文Computing the Cycles in the Perfect S...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/science/computer-science">计算机科学</a> » <a href='http://zhiqiang.org/blog/tag/%e7%ae%97%e6%b3%95'>算法</a>  » </p><div class="series"><span>系列：<b>面试题</b></span><br/>
<a href="http://zhiqiang.org/blog/tag/%e9%9d%a2%e8%af%95%e9%a2%98">查看该系列所有文章</a>
<div id='series'></div>
</div>  <p>珍爱生命，远离政治。我们继续讨论算法。</p>
<p><strong>2008/04/01补充：此算法有重大缺陷。详情请见留言部分。</strong></p>
<p>一年前，我们讨论过一个算法问题，perfect shuffle，据称是个微软面试题：</p>
<blockquote><p>输入<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_b50799dad81f21d20410095ecd84c892.gif' style='vertical-align: middle; border: none; ' class='tex' alt="a_1,a_2,\cdots,a_n,b_1,\cdots,b_n" /></span><script type='math/tex'>a_1,a_2,\cdots,a_n,b_1,\cdots,b_n</script>，如何用<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_7ba55e7c64a9405a0b39a1107e90ca94.gif' style='vertical-align: middle; border: none; ' class='tex' alt="O(n)" /></span><script type='math/tex'>O(n)</script>的时间，<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_5e079a28737d5dd019a3b8f6133ee55e.gif' style='vertical-align: middle; border: none; ' class='tex' alt="O(1)" /></span><script type='math/tex'>O(1)</script>的空间，将这个序列顺序改为<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_d8523d1d0596a2a4106b0177db60807a.gif' style='vertical-align: middle; border: none; ' class='tex' alt="a_1,b_1,\cdots,a_n,b_n" /></span><script type='math/tex'>a_1,b_1,\cdots,a_n,b_n</script>。</p>
</blockquote>
<p><a href="http://zhiqiang.org/blog/science/computer-science/an-algorithm-face-interviews-question-test.html">那一次讨论</a>我们翻出了问题的来源，一篇长达12页的论文<a href="http://webhome.cs.uvic.ca/~jellis/Publications/shuffle.ps">Computing the Cycles in the Perfect Shuffle Permutation</a>，算法那是非常的复杂，我估计贴出来都没几个人仔细看。</p>
<p>这一次，Xie Xie（没错，又是他 <img src='http://zhiqiang.org/blog/wp-includes/images/smilies/smile.gif' alt=':)' class='wp-smiley' /> ）翻出了Art of Computer Programming, Volume 3上的一个难度为40分的Merge Sort习题：</p>
<blockquote><p>已知数列<span class='MathJax_Preview'><img src='http://zhiqiang.org/blog/wp-content/plugins/latex/cache/tex_7ad9ebc8e2af92fd300bda645d389cde.gif' style='vertical-align: middle; border: none; ' class='tex' alt="x_1\leq x_2\leq \cdots x_M, x_{M+1}\leq x_{M+2}\leq\cdots\leq x_n" /></span><script type='math/tex'>x_1\leq x_2\leq \cdots x_M, x_{M+1}\leq x_{M+2}\leq\cdots\leq x_n</script>，设计算法使得在线性时间，常数空间实现归并，也就是将原数组排序。</p>
</blockquote>
<p>而Perfect Shuffle问题是可以规约到这个Merge Sort问题的：</p>
<blockquote><pre>mergeSort(x[1...2n]); <span style="color: #008000">// if this function solve Merge Sort problem</span>
perfectShuffle(x[1...2n]): <span style="color: #008000">// then this solve Perfect Shuffle problem</span>
     m &lt;- <span style="color: #0000ff">max</span>(x[1...2n])+1;
     x[i] &lt;- x[i]+(2i-1)m,
     x[i+n] &lt;- x[i+n] + 2im
     mergeSort(x[1...2n])
     x[i] &lt;- x[i]%m</pre>
</blockquote>
<p>原来我还不相信这个问题会是一个面试题。现在我信了。因为那个归并排序的算法还是有些牛人会知道的。</p>
<p>很好很强大。</p>
<p>&nbsp;</p>
<p>另注：从2006年4月1号愚人节<a href="http://zhiqiang.org/blog/memopad/hello-world.html">开始</a>，阅微堂成立两周年了。</p>
<p>过去一年，阅微堂共发表了201篇文章，其中包括Liu Tao先生的<a href="http://zhiqiang.org/blog/author/liutao">19篇文章</a>，sog white的17篇文章，以及一些授权转载的网友原创作品。共3389条留言。</p>
<p>感谢大家的关注和对阅微堂的支持。</p>
<div><h4>相关文章</h4><ul><li><a href="http://zhiqiang.org/blog/science/computer-science/an-algorithm-face-interviews-question-test.html">一个算法面试题 &#038; 面试题库</a></li><li><a href="http://zhiqiang.org/blog/memopad/reading-a-micro-appear-anniversary.html">阅微堂一周年</a></li><li><a href="http://zhiqiang.org/blog/science/game-two-hats.html">帽子游戏二</a></li><li><a href="http://zhiqiang.org/blog/science/googles-crazy-face-questions.html">Google的疯狂面试题</a></li><li><a href="http://zhiqiang.org/blog/it/emc-2008-10-writing-test.html">2008年10月EMC笔试</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/163-written-test-problems.html">网易笔试题</a></li><li><a href="http://zhiqiang.org/blog/science/worldquant-written-test-2007.html">WorldQuant的笔试题</a></li><li><a href="http://zhiqiang.org/blog/science/a-brain-teaser-microsoft.html">毛毛虫爬棍子面试题</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/3-color-a-simple-graph.html">一个简单图的三染色算法问题</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/max-drawdown-algorithm.html">最大回撤和最大短期回撤的线性算法</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2008. | <a href="http://zhiqiang.org/blog/science/computer-science/another-perfect-shuffle-algorithm.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/science/computer-science/another-perfect-shuffle-algorithm.html#comments">21 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/science/computer-science/another-perfect-shuffle-algorithm.html/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>

