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 ...
随机推荐
- 关于ADO.NET的基本介绍
关于ADO.NET ADO.NET是微软提供的一种数据库访问方式.他使得.NET程序员对于不同的数据库都能采用相同的访问方式. Connection 连接 Connection是一个数据库连接类,他负 ...
- kbengine mmo源码(完整服务端源码+资源+完整客户端源码)
本项目作为kbengine服务端引擎的客户端演示而写 更新kbengine插件库(https://github.com/kbengine/kbengine_unity3d_plugins): ...
- MySQL的存储引擎整理
01.MyISAM MySQL 5.0 以前的默认存储引擎.MyISAM 不支持事务.也不支持外键,其优势是访问的速度快,对事务完整性没有要求或者以SELECT.INSERT 为主的应用基本上都可以使 ...
- MyEclipse各种操作
MyEclipse console没有显示的解决方法 1.进window菜单 ->show view->console 2.还是window菜单->preferences-& ...
- Linux下Mysql主从复制(Master-Slave)与读写分离(Amoeba)实践
一.为什么要做Mysql的主从复制(读写分离)?通俗来讲,如果对数据库的读和写都在同一个数据库服务器中操作,业务系统性能会降低.为了提升业务系统性能,优化用户体验,可以通过做主从复制(读写分离)来减轻 ...
- URI中的常用属性
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA00AAACDCAIAAADea2ciAAAgAElEQVR4nOz9eTxU////j8/Y930pIb
- mariadb的select语句
mariadb的查询流程图 select语句的从句分析顺序:from(过滤表)-->where(过滤行)-->group by(分组)-->having(分组过滤)-->ord ...
- php文件hash算法,秒传原理
header('Content-type:text/html;Charset=UTF-8'); define('blockSize', 4*1024*1024); var_dump(fileHash( ...
- php简单缓存类
<?phpclass Cache { private $cache_path;//path for the cache private $cache_expire;//seconds ...
- 画画板--第三方开源--DrawableView
Android上的第三方开源DrawableView支持手写,类似于写字板.DrawableView支持改变画笔颜色,画笔线条粗细,画布的手势缩放和拖曳显示部分区域.并最终支持将手绘的图保存到本地.在 ...