Careercup - Google面试题 - 4847954317803520
2014-05-08 21:33
原题:
largest number that an int variable can fit given a memory of certain size
题目:给定特定内存大小,请问int型的变量能表示的最大整数是多少?
解法:这个“Guy”出的题目总是这样表意不清。特定大小的内存是什么意思?他要说的是字长吧?16位int占两字节,32位以后int都占四字节。这样能表示的最大整数就是(1 << sizeof(int) * 8 - 1) - 1。
代码:
// http://www.careercup.com/question?id=4847954317803520
// For n bits, signed integer can reach 2 ^ (n - 1) - 1.
// For n bits, unsigned integer can reach 2 ^ n - 1.
// My question is: is this a real Google interview question? Onsite interview?
// This guy named 'guy' has been posting an awful lot of questions on Careercup, which contains some difficult, tricky, trivial and stupid ones.
// I doubt if he's simply trying to gather more reputation, by means of spam questions. If he's not telling the truth, he's polluting Careercup and misleading other visitors here.
// He should be warned and punished.
int main()
{
return ;
}
Careercup - Google面试题 - 4847954317803520的更多相关文章
- Careercup - Google面试题 - 5732809947742208
2014-05-03 22:10 题目链接 原题: Given a dictionary, and a list of letters ( or consider as a string), find ...
- Careercup - Google面试题 - 5085331422445568
2014-05-08 23:45 题目链接 原题: How would you use Dijkstra's algorithm to solve travel salesman problem, w ...
- Careercup - Google面试题 - 6332750214725632
2014-05-06 10:18 题目链接 原题: Given a ,) (,) (,), (,) should be returned. Some suggest to use Interval T ...
- Careercup - Google面试题 - 5634470967246848
2014-05-06 07:11 题目链接 原题: Find a shortest path ,) to (N,N), assume is destination, use memorization ...
- Careercup - Google面试题 - 5680330589601792
2014-05-08 23:18 题目链接 原题: If you have data coming in rapid succession what is the best way of dealin ...
- Careercup - Google面试题 - 5424071030341632
2014-05-08 22:55 题目链接 原题: Given a list of strings. Produce a list of the longest common suffixes. If ...
- Careercup - Google面试题 - 5377673471721472
2014-05-08 22:42 题目链接 原题: How would you split a search query across multiple machines? 题目:如何把一个搜索que ...
- Careercup - Google面试题 - 6331648220069888
2014-05-08 22:27 题目链接 原题: What's the tracking algorithm of nearest location to some friends that are ...
- Careercup - Google面试题 - 5692127791022080
2014-05-08 22:09 题目链接 原题: Implement a class to create timer object in OOP 题目:用OOP思想设计一个计时器类. 解法:我根据自 ...
随机推荐
- C puzzles详解【51-57题】
第五十一题 Write a C function which does the addition of two integers without using the '+' operator. You ...
- dwz简单配置与操作
1.首先将dwz的文件放到你的项目中(http://yunpan.cn/QbTH4kN6UXX9B) 2.在页面中将前台数据复制到页面中,将js,css等路径配置好 3.这个地方一定要配置好,xml文 ...
- js设计模式(11)---命令模式
0.前言 早上好,早晨的时光总是美好的,坐在空调屋里,看着外边的蓝天白云,不停地敲击着键盘,多么美好地享受,也许屌丝就是如此容易满足. 1.什么是命令模式? 用于将一个请求封装为一个对象,从而可用不同 ...
- Case When Exists SQL
The Case-When-Exists expression in Oracle is really handy. Here's an example of how to use it in a s ...
- [leetcode]_Palindrome Number
判断integer是否为回文串(负数全部不为回文串) 思路很直接,提取出integer中的每一位,一头一尾进行比较是否相同. 一次AC , 直接上代码: public boolean isPalind ...
- 【Window】Tor(洋葱头路由)+Privoxy 网络实践(附带Java实例代码)
1.背景 平时我们需要访问onion后缀的网站,需要通过Tor(The Onion Router,洋葱路由器).一般来说安装Tor Broswer就可以满足需要.但是项目我要做的是通过程序来获取oni ...
- 【转】mysql字符串函数
对于针对字符串位置的操作,第一个位置被标记为1(即:第一个字母索引为1). ASCII(str) 返回字符串str的 最左面字符的ASCII代码值.如果str是空字符串, 返回0.如果str是NULL ...
- 统计图表--第三方开源--MPAndroidChart(一)
效果图1: 效果图2: MPAndroidChart是在Android平台上开源的第三方统计图表库,可以绘制样式复杂.丰富的各种统计图表,如一般常见的折线图.饼状图.柱状图.散点图.金融股票中使用的的 ...
- delphi中的ClientDataSet组件的open和Execute方法各自在什么情况下用?
ClientDataSet组件本来是给midas用的,也是所谓的borland的三层数据技术,使用这个控件必须发行midas.dll挺麻烦的 open是通过应用的SQL语句为SELECTexecute ...
- python zip函数介绍
首先用help(zip)来看一下帮助文档: