Careercup - Microsoft面试题 - 5204967652589568
2014-05-11 23:57
原题:
identical balls. one ball is heavy. find the heavy ball with only measurements ........ dead easy.
题目:9个看起来一样的球,其中有一个偏重。给定一个不能给出具体重量,但可以比较轻重的天平,称2次找出那个重球。
解法:9个球三等分,称一次找出包含重球的那三个。3个球三等分,称一次找出重球。
代码:
// http://www.careercup.com/question?id=5204967652589568
Answer:
Split the balls into three groups of balls.
Choose two groups and weigh them on the balance:
If balanced, the heavy ball is in the other group.
If imbalanced, the heavy ball is in the heavier group.
Find the group with the heavy ball, pick two balls from the three and weigh them:
If balanced, the heavy ball is the other one.
If imbalanced, the heavy ball is the heavier one.
Careercup - Microsoft面试题 - 5204967652589568的更多相关文章
- Careercup - Microsoft面试题 - 6314866323226624
2014-05-11 05:29 题目链接 原题: Design remote controller for me. 题目:设计一个遥控器. 解法:遥控什么?什么遥控?传统的红外线信号吗?我只能随便说 ...
- Careercup - Microsoft面试题 - 6366101810184192
2014-05-10 22:30 题目链接 原题: Design database locks to allow r/w concurrency and data consistency. 题目:设计 ...
- Careercup - Microsoft面试题 - 24308662
2014-05-12 07:31 题目链接 原题: I have heard this question many times in microsoft interviews. Given two a ...
- Careercup - Microsoft面试题 - 5700293077499904
2014-05-12 00:02 题目链接 原题: For a given map (ie Bing map) given longitude/latitude/ how would you desi ...
- 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. 题目:请描述进程和线程的区别. 解法:操作系统理论题.标准答案在恐龙书 ...
- Careercup - Microsoft面试题 - 5173689888800768
2014-05-11 05:21 题目链接 原题: Complexity of a function: int func_fibonacci ( int n) { ) { return n; } el ...
- Careercup - Microsoft面试题 - 6282862240202752
2014-05-11 03:56 题目链接 原题: Given an integer array. Perform circular right shift by n. Give the best s ...
- Careercup - Microsoft面试题 - 5428361417457664
2014-05-11 03:37 题目链接 原题: You have three jars filled with candies. One jar is filled with banana can ...
随机推荐
- Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed.
地图定位 错误:使用CoreLocation获取地理位置信息,报错 Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be ...
- Windowsphone本地应用信息与市场信息的获取
本地信息都存放在 WMAppManifest 里面,获取就不用说了...知道位置 就知道怎么获取了.. 主要是讲那个 市场上面的详情怎么获取,就是API调用显示在这个页面里面的详情: public v ...
- (四)、 nodejs中Async详解之一:流程控制
为了适应异步编程,减少回调的嵌套,我尝试了很多库.最终觉得还是async最靠谱. 地址:https://github.com/caolan/async Async的内容分为三部分: 流程控制:简化十种 ...
- GridView 鼠标经过时变色两种方法
第一种: 新建一个js文件 并引用 <script src="jquery.js" type="text/javascript"></scri ...
- MHA学习笔记
MHA是一款开源的MySQL高可用程序,为MySQL主从复制架构提供了节点故障转移功能,当 master发生故障时MHA会自动提升拥有最新数据的slave节点成为新的主节点,还提供了master节 点 ...
- mssql 置疑的处理
declare @dbName sysName ALTER DATABASE @dbName SET EMERGENCY ALTER DATABASE @dbName SET SINGLE_USER ...
- 高性能MySQL——第一章MySQL的架构与历史
1.可以使用SHOW TABLE STATUS查询表的相关信息. 2.默认存储引擎是InnoDB,如果没有什么很特殊的要求,InnoDB引擎是我们最好的选择. 3.mysql的infobright引擎 ...
- eval和new Function的区别
eval和new Function都可以动态解析和执行字符串.但是它们对解析内容的运行环境判定不同. var a = 'global scope' function b(){ var a = 'loc ...
- 线程操作API
线程操作API 1.currentThread 2.getId() .getName().getPriority().getStart.isAlive().isDaemon().isInterrupt ...
- ES6 入门系列 - 函数的扩展
1函数参数的默认值 基本用法 在ES6之前,不能直接为函数的参数指定默认值,只能采用变通的方法. function log(x, y) { y = y || 'World'; console.log( ...