由买买提看人间百态

topics

全部话题 - 话题: bignum
(共0页)
j**c
发帖数: 9
1
来自主题: JobHunting版 - 失荆州 - G电面经
/*
* 失荆州 - G电面经
*
两道G的电面题:
-----------------------------------------------------------
1. You are going to work with “bigNums”, which are
objects containing a positive integer with an
unlimited number of decimal digits.
a) declare a struct to represent “bigNums”
b) write a function that takes as arguments a bigNum
and a positive integer between 0 and 9, adds them
and returns the answer (a bigNum)
10 - 9 = 1
--------------
2. You are given two very large files of unsigned 64
bit integers. Write t... 阅读全帖
W*****d
发帖数: 4196
2
【 以下文字转载自 JobHunting 讨论区 】
发信人: fightclub (搏击俱乐部), 信区: JobHunting
标 题: A, A, G, G, L, C, Z, U 面经 + offer
发信站: BBS 未名空间站 (Fri Dec 18 11:43:09 2015, 美东)
之前也onsite了dropbox, pintreset, 和whatsapp都挂了,后来才慢慢找到点感觉。我
把面的题基本都写下了,但我不在这里和大家讨论这些题了。
A (Airbnb)
1. 2D array, 访问顺序必须是‘回’字的方式,就是从外圈转到里圈,写出class,
Iterator, hasNext(), next().
2. 电话号码和计费的一个log, 去parse 看规定时间内哪个号码产生费用最高。
3. leetcode anagram 的一题变种
4. 有很多个sorted queue存在不同服务器上,如何有效的读取到一个 sorted 大queue
里 (google也面到了这题)
5. 设计db, 如何存取房东和房客的reviews, 如何maintain... 阅读全帖
f*******b
发帖数: 520
3
来自主题: JobHunting版 - A, A, G, G, L, C, Z, U 面经 + offer
之前也onsite了dropbox, pintreset, 和whatsapp都挂了,后来才慢慢找到点感觉。我
把面的题基本都写下了,但我不在这里和大家讨论这些题了。
A (Airbnb)
1. 2D array, 访问顺序必须是‘回’字的方式,就是从外圈转到里圈,写出class,
Iterator, hasNext(), next().
2. 电话号码和计费的一个log, 去parse 看规定时间内哪个号码产生费用最高。
3. leetcode anagram 的一题变种
4. 有很多个sorted queue存在不同服务器上,如何有效的读取到一个 sorted 大queue
里 (google也面到了这题)
5. 设计db, 如何存取房东和房客的reviews, 如何maintain他们之间的关系。
Airbnb确实和大家说得一样面试官很nice, 内部装潢笔格明显很高,非常酷炫.
offer: 160k + 5000股/2年 = 260k
A (Amazon)
1. leetcode tree的一题,就是每层的nodes横着也是连着的
2. 设计搜索,在amazon搜索如何设计。... 阅读全帖
a*****g
发帖数: 19398
4
来自主题: Programming版 - 计算围棋棋盘合法图案的源代码
#!/usr/bin/env pike
// legal.pike - Count the number of legal go boards.
// Copyright 2005 by Gunnar Farneb?ck
// [email protected]
/* */
//
// You are free to do whatever you want with this code.
//
//
// This program computes the number of legal go board configurations
// for a rectangular board of a given size. It is efficient enough to
// handle boards up to 8x8 within minutes and up to 11x11 in less than
// 24 hours (on a fast computer). For rectangular boa... 阅读全帖
W*****d
发帖数: 4196
5
【 以下文字转载自 JobHunting 讨论区 】
发信人: fightclub (搏击俱乐部), 信区: JobHunting
标 题: A, A, G, G, L, C, Z, U 面经 + offer
发信站: BBS 未名空间站 (Fri Dec 18 11:43:09 2015, 美东)
之前也onsite了dropbox, pintreset, 和whatsapp都挂了,后来才慢慢找到点感觉。我
把面的题基本都写下了,但我不在这里和大家讨论这些题了。
A (Airbnb)
1. 2D array, 访问顺序必须是‘回’字的方式,就是从外圈转到里圈,写出class,
Iterator, hasNext(), next().
2. 电话号码和计费的一个log, 去parse 看规定时间内哪个号码产生费用最高。
3. leetcode anagram 的一题变种
4. 有很多个sorted queue存在不同服务器上,如何有效的读取到一个 sorted 大queue
里 (google也面到了这题)
5. 设计db, 如何存取房东和房客的reviews, 如何maintain... 阅读全帖
a*****g
发帖数: 19398
6
来自主题: Mathematics版 - 计算围棋棋盘合法图案的源代码
【 以下文字转载自 Programming 讨论区 】
发信人: ananpig (●○ 围棋数学一把抓的安安猪), 信区: Programming
标 题: 计算围棋棋盘合法图案的源代码
发信站: BBS 未名空间站 (Fri Jan 22 10:39:02 2016, 美东)
#!/usr/bin/env pike
// legal.pike - Count the number of legal go boards.
// Copyright 2005 by Gunnar Farneb?ck
// [email protected]
/* */
//
// You are free to do whatever you want with this code.
//
//
// This program computes the number of legal go board configurations
// for a rectangular board of a given size. It is ef... 阅读全帖
t*********n
发帖数: 89
7
来自主题: JobHunting版 - 问一个facebook的电面
void calculateBit(string &result, const string b,int k){
result.push_back('0');
int carry = 0;
int i;
for (i=1; i<=b.size(); i++) {

int m =b[b.size()-i]-'0';
int r=0;
if (i>result.size()) {
result = '0'+result;
}
r = result[result.size()-i]-'0';
int sum = m*k + carry + r;
result[result.size()-i] = sum%10+'0';
carry = sum/10;
}


while (carry!=0) {
if (i>result.size()) {
... 阅读全帖
h****e
发帖数: 928
8
来自主题: JobHunting版 - 问个题 weighted random sampling
那就用BigNum之类的。
h****e
发帖数: 928
9
来自主题: JobHunting版 - 问个题 weighted random sampling
那就用BigNum之类的。
s********k
发帖数: 6180
10
来自主题: JobHunting版 - 失荆州 - G电面经
bigNums用什么最好?vector?string?linked list?
p*****2
发帖数: 21240
11
来自主题: JobHunting版 - 失荆州 - G电面经

a) declare a struct to represent “bigNums”
这题用Java不简单多了。还用define?
c****p
发帖数: 6474
12
来自主题: JobHunting版 - 失荆州 - G电面经
bignums可以用int数组或者value为int的linklist吧,每个元素/结点可以多存几位,比
如每个结点可以千进位,万进位(32位的int实际可以以10^9进位)。这样空间和时间都
省不少,虽然只是省出一个比较小的常数。。。。
j******2
发帖数: 362
13
来自主题: JobHunting版 - c++定义bignum
要求可以有无穷多位数,用什么数据结构比较好?vector?linked list?pre allocated
large array?
a****l
发帖数: 8211
14
来自主题: JobHunting版 - c++定义bignum
不可能有无穷多位数的.有限的计算机只能计算有限的位数.

allocated
B*********3
发帖数: 36
15
来自主题: JobHunting版 - c++定义bignum
array比较好。array里面的每个element表示一位数
s******k
发帖数: 6659
16
来自主题: JobHunting版 - A, A, G, G, L, C, Z, U 面经 + offer
BigNum那题就是数括号吧?比如左括号加一,右括号减一,然后存一下最大的数。
把每个数对应的layer也存着,最后两个vector取乘积就是第二问的答案了。
k****f
发帖数: 3794
17
来自主题: Programming版 - 这种数值的问题怎么办呢
做laplace逆变换
中间结果是一堆浮点数求和:有大有小,有正有负
大的能够到10^40,小的能小到10^(-40),
求和结果是应该在10^(-40)附近。
现在程序写出来,可是不稳定。。
经常变成负的(应该是正的结果)。
有谁给推荐一个数值稳定的laplace变换软件包
不能用bignum,速度实在是太慢了。
k**********g
发帖数: 989
18
来自主题: Programming版 - GOOGLE一道 面试题目
just guess ...
nchoosek(25, 12) / nchoosek(11, 6) / nchoosek(8, 2) / nchoosek(6, 4)
nchoosek(n, k) = factorial(n) / factorial(k) / factorial(n-k)
all values must be bignum
Could be wrong ... this question made me realize I haven't used discrete
math for 10 years.
Very good that Google looks for a skill that nobody use for 10 years :)
l*********s
发帖数: 5409
19
好像不是bignum,我问考官数值范围他说用系统的int就行,但是这样溢出肯定要处理
了,不知道是不是除了异常还有其他的trick?
k****f
发帖数: 3794
20
来自主题: Mathematics版 - 这种数值的问题怎么办呢
【 以下文字转载自 Programming 讨论区 】
发信人: kukutf (五脚蟹★酷酷豆腐), 信区: Programming
标 题: 这种数值的问题怎么办呢
发信站: BBS 未名空间站 (Fri Aug 10 12:22:32 2007), 转信
做laplace逆变换
中间结果是一堆浮点数求和:有大有小,有正有负
大的能够到10^40,小的能小到10^(-40),
求和结果是应该在10^(-40)附近。
现在程序写出来,可是不稳定。。
经常变成负的(应该是正的结果)。
有谁给推荐一个数值稳定的laplace变换软件包
不能用bignum,速度实在是太慢了。
(共0页)