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 average number of gas stations per state), but you need to yield an accurate answer.

题目:你要如何搞清楚美国有多少个加油站?不准查,不准问。

解法:这个题很出名,是外行人眼里的奇葩智力题。起初我也觉得这题就是智力题,但是读了《编程珠玑》之后明白了这题是对于估算能力的考察。个人觉得估算需要三个条件:1. 发现有关联的变量。2. 明确变量构成的公式。3. 估算各个变量的值,然后计算公式结果。我想到了人口、国土面积、人口密度、之类的变量,但是没法确定加油站的数量到底和哪一个直接相关,所以还是没有办法构造公式。参考了答案以后,算是有了个结论:加油站和人口相关。这个结论真的可靠?

代码:

 // http://www.careercup.com/question?id=5680049562845184
Answer:
The number of gas stations is related to population, instead of area of land.
Thus you have to find out the average density of gas stations by population. Here's the answer from another user:
From the US census you can look up what is the average density of gas station / population ( some number ). Multiply that by the population and you get the answer.
gas stations / people * (,) = gas stations. Although this answer will be within the standard deviation and you will have to find the upper and lower limit
+- std.dev.
Another way would be to do data mining. Either way you need some information, you cannot pull a number out of thin air. Well, unless you travel through each and every street and corner of the country.
Another great idea: gather telephone books from each and every area of the US and count the number of gas stations in each region and add them up. Not all gas stations are labelled gas stations.
So, pick and choose, or maybe another idea!!

Careercup - Microsoft面试题 - 5680049562845184的更多相关文章

  1. Careercup - Microsoft面试题 - 6314866323226624

    2014-05-11 05:29 题目链接 原题: Design remote controller for me. 题目:设计一个遥控器. 解法:遥控什么?什么遥控?传统的红外线信号吗?我只能随便说 ...

  2. Careercup - Microsoft面试题 - 6366101810184192

    2014-05-10 22:30 题目链接 原题: Design database locks to allow r/w concurrency and data consistency. 题目:设计 ...

  3. Careercup - Microsoft面试题 - 24308662

    2014-05-12 07:31 题目链接 原题: I have heard this question many times in microsoft interviews. Given two a ...

  4. Careercup - Microsoft面试题 - 5700293077499904

    2014-05-12 00:02 题目链接 原题: For a given map (ie Bing map) given longitude/latitude/ how would you desi ...

  5. Careercup - Microsoft面试题 - 5204967652589568

    2014-05-11 23:57 题目链接 原题: identical balls. one ball measurements ........ dead easy. 题目:9个看起来一样的球,其中 ...

  6. Careercup - Microsoft面试题 - 5175246478901248

    2014-05-11 23:52 题目链接 原题: design an alarm clock for a deaf person. 题目:为聋人设计闹钟? 解法:聋人听不见,那么闪光.震动都可行.睡 ...

  7. Careercup - Microsoft面试题 - 5718181884723200

    2014-05-11 05:55 题目链接 原题: difference between thread and process. 题目:请描述进程和线程的区别. 解法:操作系统理论题.标准答案在恐龙书 ...

  8. Careercup - Microsoft面试题 - 5173689888800768

    2014-05-11 05:21 题目链接 原题: Complexity of a function: int func_fibonacci ( int n) { ) { return n; } el ...

  9. Careercup - Microsoft面试题 - 6282862240202752

    2014-05-11 03:56 题目链接 原题: Given an integer array. Perform circular right shift by n. Give the best s ...

随机推荐

  1. Android开发教程 录音和播放

    首先要了解andriod开发中andriod多媒体框架包含了什么,它包含了获取和编码多种音频格式的支持,因此你几耍轻松把音频合并到你的应用中,若设备支持,使用MediaRecorder APIs便可以 ...

  2. 创建带sshd服务的docker image

    参考:https://docs.docker.com/examples/running_ssh_service/ 1. 创建一个空目录用于存放Dockerfile mkdir -p /home/thm ...

  3. ubuntu下使用nethogs监控网络流量

    NetHogs是一款小巧免费的开源命令行工具,用来按进程或程序实时统计网络带宽使用率. 对于使用类似于“repo tool”.“depot_tools”等工具checkout源码时非常有用,可以查看当 ...

  4. sublime配置问题

    sublime本身功能有限,我们需要装上一些插件使其变得强大.sublime在各个操作系统下都可以运行,但在linux下运行需要注意中文输入的问题. 下面我主要介绍一下常用插件.配置的建议以及在lin ...

  5. PHP变量名区分大小写,函数名不区分大小写

    PHP变量名区分大小写,函数名不区分大小写,经常被新手忽视的小细节,测试如下. PHP变量名区分大小写测试: <?php $aaa = "phpddt.com"; $AAA ...

  6. 从零开始之ecshop基础篇(17)

    目标:基于自定义的mvc框架开发的案例(项目) 项目周期    需求分析 典型的业务逻辑:    电子商务:商城(京东),B2C,C2C(淘宝),团购,秒杀,代购 内容管理:新浪门户类,优酷视频管理, ...

  7. 了解Unix进程(2)

    1. 每个进程都有一个名字,crusher 可以得到: # process name puts $PROGRAM_NAME 10.downto(1) do | num | $PROGRAM_NAME ...

  8. 用户View,五大布局

    1.LinearLayout 线性布局 android:orientation="horizontal" 制定线性布局的排列方式 水平 horizontal 垂直 vertical ...

  9. STL之迭代器

    容器支持的迭代器类型  STL Container  Type of Iterators Supported   vector  random access iterators 元素严格有序(类似数组 ...

  10. 解决 MVC 用户上线下线状态问题

    以前工作项目中就有一个微博类功能,其中也出现了用户在线和离线的问题. 但是因为初入程序猿 使用的是 Session _end 上个事件. Session _end 这个事件不需要怎么解释吧 就是在se ...