由买买提看人间百态

topics

全部话题 - 话题: integ
首页 上页 1 2 3 4 5 6 7 8 9 10 (共10页)
t********e
发帖数: 1169
1
【 以下文字转载自 JobHunting 讨论区 】
发信人: mitbbs59 (bEQi), 信区: JobHunting
标 题: 本版1年以内的所有 面经题目,含帖子link [为大家方便]
发信站: BBS 未名空间站 (Fri Jan 29 14:20:44 2010, 美东)
不敢保证全部涵盖,大部分的都在。
我自己找了一遍,大家一起用着都方便。
不过只是含有题目的帖子 我才包含进来了,只分享经验没贴题目的 我都没有包含
进来。
大家复习着方便。
1. 一个sorted interger Array[1...N], 已知范围 1...N+1. 已知一个数字missing。
找该数字。
把原题改为unsorted,找missing数字。 performance。
2. 复制linked list。 已知每个节点有两个pointer,一个指向后一个节点,另一个指向
其他任意一节点。 O(n)时间内,无附加内存,复制该linked list。(存储不连续)
3. 一个party N个人,如果一个人不认识任何其他人,又被任何其他人认识,此人为
celeb... 阅读全帖
l**********1
发帖数: 5204
2
来自主题: Biology版 - sort vectors
How to sort a generic List
After reading this post from Steven Smith I thought I should write something about it.
Sorting a generic List is pretty straightforward if you know how to do it. With C# 2.0, anonymous
methods come at hand, as well as the little known Comparison delegate (check out this post for more
information about this class as well as other useful classes new to C# 2.0).
Ok, let's suppose we have a product class (let me save some space by using C# 3.0 syntax).
-----
Publi... 阅读全帖
a*********3
发帖数: 660
3
定义 definition变量 variable面积 area直径 diameter半径 radius公式 formula
单价 unit price范围 range/scope/extent集合 set法则 principle本金 principal利
率 interest rate利息 interest单利 simple interest复利 compound interest正数
positive number负数 negative number解析式 analytic expression分类讨论
classified discussion性质 nature (不是很确定)奇函数 odd function偶函数
even function对称 symmetric坐标原点 origin单调性 monotonicity(不是很确定)
任意 random周期性 periodic 有界性 boundedness 数学 mathematics, maths(BrE)
, math(AmE) 公理 axiom 定理 theorem 计算 calculation 运算 operat... 阅读全帖
w*********l
发帖数: 1337
4
来自主题: Statistics版 - 问一下证明
挺有道理的,不过integ[integ(x)f(x,y)dxdy]+inte[integ(y)f(x,y)dxdy]=integ[xf(
x)dx]+integ[yf(y)dy]
不知道有没有严格的证明。我能想象dxdy是一块小面积,那f(x,y)dxdy从y方向上积起
来就是整个长条的密度乘以dx。
不过就是这么想还是有点太大白话了,不知道怎么用数学语言描述。

y)
w*******n
发帖数: 469
5
请问下面的R Code 怎么用Loop来实现?
这里的comb是list.
先谢谢了!
comb$I.1<-as.integer(as.character(comb$I.1))
comb$I.2<-as.integer(as.character(comb$I.2))
comb$I.3<-as.integer(as.character(comb$I.3))
comb$I.4<-as.integer(as.character(comb$I.4))
comb$I.5<-as.integer(as.character(comb$I.5))
l******t
发帖数: 55733
6
弄个稍微复杂点的generic伪代码,如果有lambda就更爽了。不知道新的Java 8有没
filter/map/folder。Number有没扩充。
List filter (final List list, Filter filter) {
if(list == null) return null;
List ret = new LinkedList();
for(T item: list){
if(filter(item) ret.add(item);
}
return ret;
}
interface Filter{
boolean filter(T);
}
List removeNeg(List list){
return filter(list, new Filter{
@Override boolean filter(Integer num){ return n... 阅读全帖
c*********n
发帖数: 1282
7
来自主题: Military版 - LC 387 怎么优化
希望大家都能拿到大包裹,我帖一个答案吧。其实就一层床糊纸。
import java.io.IOException;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import java.util.Set;
public class FirstUniqueCharacter {

public int firstUniqChar(String s)
{
Set set = new HashSet();
LinkedHashMap result = new LinkedHashMap Integer>();
for (int i=0; i char c = s.charAt(i);
if (set.contains(c)) {
resu... 阅读全帖
B*******1
发帖数: 2454
8
来自主题: JobHunting版 - 问几个老算法题的最佳解法
1.Find the first non-repeating character in a string
这个是不是一定要Scan第一遍记录下所有Character出现的次数,然后在Scan第2遍
得到第一个不重复的啊?
2. Return the sum two largest integers in an array
这个是不是就是找出数组里面最大的2个数就可以了啊?但是又似乎不是这么简单。
3.Sum n largest integers in an array of integers where every integer is
between 0 and 9
这个完全没有头绪
请指教,
Thanks
H*X
发帖数: 281
9
来自主题: JobHunting版 - 再来一道简单的bit运算题
我不明白这道题, 为什么不可以当成普通的算法做, 一个integer的长度是固定的, 如
果fetch一个bit是constant,那么比如说一个32bits的integer,我把每个bits都fetch一
边也是constant,那样只要针对每个integer,把bit都读出来,加一起, 就得到这个
integer的值了,这就和把所有a[i]加一起然后对比sum的算法一样了
career cup的解法是算column sum,运算的时间是一样的,也都是要吧所有的bit加一起
g******i
发帖数: 354
10
"Sort完然后用19减一下就可以Binary Search了" 这个好像不行。 你能把程序写出来
吗?
前面的讨论很对,Sort完然后用 Binary Search 应该不行的。 请达人指正。
另外, 我修改了原帖, 原来的题目有空间限制, 用Hash不好。
不过, 如果用Hash的话, 程序如下,关键也是用Hash查找 sum-a[i], 时间复杂度是O(1) if we use Hash to search. 整个程序
complexity is O(n)。
void findSum2() {
int[] a = {8, 10, 2, 9, 5, 7, 1};
int sum = 19;

HashMap hm = new HashMap();
for (int i=0; i hm.put(a[i], i); //i is the index of the eleme
j*******o
发帖数: 246
11
来自主题: JobHunting版 - 笔试题目求助!
各位能稍微讲解一下,或给个相关参考文献链接之类的么?题目如下
There is a log file containing 1 million integers. Each integer is 32 bits
in length. Specific integer values in the log file may be repeated. It is
possible to read the log file sequentially. It is possible to read and write
temp files sequentially; however, no more than 2000 integers may be read
into memory at any given time. There is no limit to the number of files that
may be open at any time.
Objective: Produce a histogram showing absolute counts for each int
b******y
发帖数: 126
12
来自主题: JobHunting版 - Google电面被拒,郁闷中
我写的最后一道题的code,欢迎批评指正
public final class SpecialSingleton{
private Integer i;
private static Map instanceMap= new HashMap<
Integer, SpecialSingleton>();
private SpecialSingleton(Ingeter i){
this.i = i;
}
public static SpecialSingleton getInstance(Integer i){

Synchronized(instanceMap){
SpecialSingleton ss = instanceMap.get(i);
if(ss == null){
ss = new SpecialSingleton(i);
P********l
发帖数: 452
13
来自主题: JobHunting版 - gg面试题
死在这道题上:写一个Singleton.
教训:
不熟/不确定就提也不要提,忍着。
如果你对如下代码有兴趣,看看你能不能该对?
see also: http://www.mitbbs.com/article_t/JobHunting/31595909.html
public final static class SpecialSingleton {
private final Integer i;
private static ConcurrentHashMap
instanceMap = new ConcurrentHashMap(); //use
the concurrent to improve performance.
private SpecialSingleton(Integer i) //it is correct to make the
constructor private.
{
t
a*d
发帖数: 47
14
来自主题: JobHunting版 - Bitonic search的问题
An array is bitonic if it is comprised of an increasing sequence of integers
followed immediately by a decreasing sequence of integers.
Given a bitonic array a of N distinct integers, describe how to determine
whether a given integer is in the array in O(log N) steps
j**l
发帖数: 2911
15
我第三次Amazon电面写的
bool has_num(int integers[], int n, int target)
{
if (integers == NULL || n < 2)
return false;
Hashtable table;
for (int i = 0; i < n; i++)
{
if (table.contains(target - integers[i])
return true;
table.add(integers[i]);
}
return false;
}
m****e
发帖数: 14
16
1. 以下程序少了关键一句吧?
code:bool has_num(int *integers, int target)
{
for (int i=0;i {
if(num_hashtable(target-*(integers+i))
{
return true;
}
}
return false;
}
少了 num_hashtable.add(*(integers+i)) 应该是个致命bug.
h*****g
发帖数: 944
17
这两个iterator有什么区别?似乎这两个还是有细微差别的
比如 code1:
vector::reverse_iterator reverseIterator;
for(reverseIterator=integers.rbegin()reverseIterator!=integers.rend();++
reverseIterator)
cout<<*reverseIterator<<' ';
如果把iterator的type换成const_reverse_iterator, 他就会有compiling error:
Code 2:
vector::const_reverse_iterator reverseIterator;
for(reverseIterator=integers.rbegin()reverseIterator!=integers.rend();++
reverseIterator)
cout<<*reverseIterator<<' ';
但是稍微改动一下,他就work了, code3:
vector<
j**l
发帖数: 2911
18
来自主题: JobHunting版 - Amazon onsite面试的惨痛经历
版上面经要多看,反反复复的老题要熟悉
http://www.mitbbs.com/article_t1/JobHunting/31649757_0_1.html
我第三次Amazon电面写的
bool has_num(int integers[], int n, int target)
{
if (integers == NULL || n < 2)
return false;
Hashtable table;
for (int i = 0; i < n; i++)
{
if (table.contains(target - integers[i])
return true;
table.add(integers[i]);
}
return false;
}
f*******h
发帖数: 53
19
来自主题: JobHunting版 - microsoft面经
isBst(Node node, int maxValue, int minValue)
用这个做递归,刚开始maxValue=Integer.MAX_VALUE minValue=Integer.MIN_VALUE
从root做起:
isBst(root.left,root.value,Integer.MIN_VALUE) && isBst(root.right,Integer.
MAX_VALUE, root.value)
明白了么?
s******e
发帖数: 108
20
来自主题: JobHunting版 - 攒人品,twitter二面面经
public class RandomHash {
HashMap hashmap = new HashMap();
Vector vec = new Vector();
public void insert(K key) {
vec.add(key);
hashmap.put(key, new Integer(vec.size()-1));
}
public K getRand() {
if(vec.size()<=0)
return null;
Random randomGenerator = new Random();
int rndnum = randomGenerator.nextInt(vec.size());
return vec.get(rndnum);
}
public boole... 阅读全帖
I*******l
发帖数: 203
21
来自主题: JobHunting版 - 攒人品,twitter二面面经
How about using one hash table together with one array? The hash table can
be used to support O(1)-time insertions and deletions and use the array for
getRandom. Basically we maintain an array (or more precisely, a dynamic
array) of pointers for the integers in the set and a counter k for how many
integers the hash table currently contains. We will also store the index of
an element in the array in the hash table of that element. When an integer
is inserted, we add a new entry to the end of the ... 阅读全帖
I*******l
发帖数: 203
22
来自主题: JobHunting版 - 攒人品,twitter二面面经
How about using one hash table together with one array? The hash table can
be used to support O(1)-time insertions and deletions and use the array for
getRandom. Basically we maintain an array (or more precisely, a dynamic
array) of pointers for the integers in the set and a counter k for how many
integers the hash table currently contains. We will also store the index of
an element in the array in the hash table of that element. When an integer
is inserted, we add a new entry to the end of the ... 阅读全帖
o******y
发帖数: 13
23
来自主题: JobHunting版 - 一道program challenge的题
consider the process of stepping from integer x to integer y along the
integer points of the straight line. The length of each step must be non-
negative and can be one bigger than, equal to, or one smaller than the
length of the previous step.
What is the minimum number of steps in order to get from x to y? the length
of both the first and the last step must be 1.
INPUT:
the input begins with a line containing the number of test cases - n. Each
test case that follows consists of a line with two... 阅读全帖
e*****e
发帖数: 1275
24
You are given an array containing positive integers. All the integers occur
even number of times except one. Find this special integer.
Like, 1, 4, 5, 4, 3, 1, 3, 3, 5. 3 appears 3 times.
The solution is easy, just do XOR for all of them.
But, what if n integers instead of 1 occur odd number of times, how you
gonna find them out?
l****y
发帖数: 44
25
来自主题: JobHunting版 - MS onsite 面经
面的是business platform division 的SQL Server team。我简历上一个DB的keyword
都没有,我连DB的课都没上过,不
知道他们怎么选的。尽管这样,题目全是基本的算法和coding,没有考DB的任何问题。
可惜我还是表现很差,感觉脑子进
水了(或者是进seattle的雨了)。面试从12:30开始(本来说是10点,临时改了,说
是他们上午有会),见了4个人。3
个是印度人,还有一个不知道是什么国籍的。
我就把所有technical的题罗列下来吧。很多都是常见题。
给一个array of integers, 需要多少个comparison能找到min? how about min and
max? what's the best worst-
case? (3n/2)
怎么merge两个sorted的array,n 个呢?
给一个tree,把同层的nodes都连起来,assume每个node都有个指针,你要让它指向下
一个同层的node。
count 1's in an integer.
mergeSort, mergeSort without r... 阅读全帖
d****j
发帖数: 293
26
来自主题: JobHunting版 - MS onsite 面经
我就把所有technical的题罗列下来吧。很多都是常见题。
1. 给一个array of integers, 需要多少个comparison能找到min? how about min and
max? what's the best worst-case? (3n/2)
====>
n-1 comparison to find min
两两比较之后再在大的一堆中找大的,小的一堆中找小的
n/2 + n/2 - 1 + n/2 -1 = 3n/2.
记得MIT Algorithm (CLRS)上面有提到这个。
2. 怎么merge两个sorted的array,n 个呢?
====>
两个很容易,n个的话,用每个array的第一个元素构建一个heap,再heap sort,每挑
出一个值,再去对应的array中取一个值添到heap中。具体实现可能要修改数据结构。
3. 给一个tree,把同层的nodes都连起来,assume每个node都有个指针,你要让它指向
下一个同层的node。
====>
见 ihas1337code 的blog:
http://www.ihas1337code.... 阅读全帖
g***s
发帖数: 3811
27
来自主题: JobHunting版 - 问个算法题2
"In computer science, the subset sum problem is an important problem in
complexity theory and cryptography. The problem is this: given a set of
integers, does the sum of some non-empty subset equal exactly zero? For
example, given the set { −7, −3, −2, 5, 8}, the answer is
yes because
the subset { −3, −2, 5} sums to zero. The problem is NP-complete.
An equivalent problem is this: given a set of integers and an integer s,
does any non-empty subset sum to s? Subset su... 阅读全帖
s*****y
发帖数: 897
28
来自主题: JobHunting版 - 问个google 题
各位大牛有没有什么好办法啊。
The following is one tricky interview practice question.
A non-negative integer is called heavy if the average value of its digits in
decimal representation exceeds 7. Assume that 0 has average value of its
digits equal to 0.
For example the number 8698 is heavy, because the average value of its
digits equal to (8+6+9+8)/4 = 7.75. The number 53141 has the average value
of its digits equal to (5+3+1+4+1)/5 = 2.6, so it is not heavy.
Write a function (in C / C++)
int heavy_decimal_c... 阅读全帖
g***s
发帖数: 3811
29
来自主题: JobHunting版 - 一道G家题目
//nlgn
public class BTree {
Node root;
public BTree(int n) {
root = makeTree(n, 0);
}
private Node makeTree(int number, int base) {
if (number == 0) return null;
Node node = new Node((number + 1) / 2 + base);
node.numOfLeftChildren = (number - 1) / 2;
node.left = makeTree(node.numOfLeftChildren, base);
node.right = makeTree(number / 2, node.value);
return node;
}
public Node remove(int index) {
return remove(... 阅读全帖
P**********c
发帖数: 3417
30
来自主题: JobHunting版 - G面经
第9题是放一个timer再放一个static的counter吗?
第12题的意思是说这个class是个integer, 可以无穷大,还是说这个class有无穷多个
integer?
add (int) 是说加进一个integer到这个set, 还是这个integer和BigInt相加?

the
called
all
890
P**********c
发帖数: 3417
31
来自主题: JobHunting版 - G面经
第9题是放一个timer再放一个static的counter吗?
第12题的意思是说这个class是个integer, 可以无穷大,还是说这个class有无穷多个
integer?
add (int) 是说加进一个integer到这个set, 还是这个integer和BigInt相加?

the
called
all
890
g*****i
发帖数: 2162
32
来自主题: JobHunting版 - 问几道算法题
1.Given an array, find the longest subarray which the sum of the subarray
less or equal then the given MaxSum
int[] FindMaxSumArray(int[] array, int maxsum)
2. Given an array of 'n' random integers. Given an integer k<=n. Find the k
numbers such that the minimum difference of all the possible pairs of k
numbers is maximum (maximum among other minimum differences for various
possible selections of k numbers ).
3.Given an array of integers(both positive and negative) divide the array
into two part... 阅读全帖
s********e
发帖数: 340
33
来自主题: JobHunting版 - 急问一个Java Hashset的 考试题。
3. import java.util.*;
4. public class Mapit {
5. public static void main(String[] args) {
6. Set set = new HashSet();
7. Integer i1 = 45;
8. Integer i2 = 46;
9. set.add(i1);
10. set.add(i1);
11. set.add(i2); System.out.print(set.size() + " ");
12. set.remove(i1); System.out.print(set.size() + " ");
13. i2 = 47;
14. set.remove(i2); System.out.print(set.size() + " ");
15. }
16. }
What is the result?
输出结果是 211
我不理解为什么是211呢?在第14行,set.remove(i2); 这个已经将i2从set中移除了,
我觉得 set这时应该是有0个元素,... 阅读全帖
g**********y
发帖数: 14569
34
来自主题: JobHunting版 - 这个facebook puzzle样题怎么做?
这个题不好写的是状态保存和转换。
最多5个peg, 8个disc, 所以可以用long(64-bit)来保存状态,转换需要位操作。
这是我的写法,欢迎改进:
public class KPeg {
public void move(int N, int K, int[] begin, int[] end) {
long s0 = stateToLong(begin);
long sn = stateToLong(end);

ArrayList visited = new ArrayList();
visited.add(new Node(s0, 0, 0, -1));

Deque dq = new ArrayDeque();
dq.add(0);

while (!dq.isEmpty()) {
int current = dq.remov... 阅读全帖
g**********y
发帖数: 14569
35
来自主题: JobHunting版 - 问个MSFT的题
这个题在本版问过,这是当时给的解,去考古一下吧
public class LongestRange {
public int[] longest(int[] a) {
int start = 0;
int maxLen = 0;

HashMap map = new HashMap();
for (int i=0; i int left = map.containsKey(a[i]-1)? map.get(a[i]-1) : 0;
int right = map.containsKey(a[i]+1)? map.get(a[i]+1) : 0;
int len = left + 1 + right;
map.put(a[i]-left, len);
map.put(a[i]+ri... 阅读全帖
g**********y
发帖数: 14569
36
来自主题: JobHunting版 - 问个MSFT的题
这个题在本版问过,这是当时给的解,去考古一下吧
public class LongestRange {
public int[] longest(int[] a) {
int start = 0;
int maxLen = 0;

HashMap map = new HashMap();
for (int i=0; i int left = map.containsKey(a[i]-1)? map.get(a[i]-1) : 0;
int right = map.containsKey(a[i]+1)? map.get(a[i]+1) : 0;
int len = left + 1 + right;
map.put(a[i]-left, len);
map.put(a[i]+ri... 阅读全帖
q*****t
发帖数: 3
37
来自主题: JobHunting版 - 问个Amazon面试题
import java.util.ArrayList;
import java.util.List;
public class NextLargerNumberWithSameDigits {
public static void main(String[] args) throws Exception {
int a = 1245963;
System.out.println(findnext(a));
a = 698754;
System.out.println(findnext(a));
}
public static int findnext(int a) throws Exception {
List d = new ArrayList();
while (a != 0) {
d.add(a % 10);
a /= 10;
}
Integer[... 阅读全帖
q*****t
发帖数: 3
38
来自主题: JobHunting版 - 问个Amazon面试题
import java.util.ArrayList;
import java.util.List;
public class NextLargerNumberWithSameDigits {
public static void main(String[] args) throws Exception {
int a = 1245963;
System.out.println(findnext(a));
a = 698754;
System.out.println(findnext(a));
}
public static int findnext(int a) throws Exception {
List d = new ArrayList();
while (a != 0) {
d.add(a % 10);
a /= 10;
}
Integer[... 阅读全帖
j********e
发帖数: 48
39
来自主题: JobHunting版 - 问个关于排序的面试题
Write a program that takes a list of strings containing integers and words
and returns a sorted version of the list. The goal is to sort this list in
such a way that all words are in alphabetical order and all integers are in
numerical order. Furthermore, if the nth element in the list is an integer
it must remain an integer, and if it is a word it must remain a word.
a*****g
发帖数: 110
40
来自主题: JobHunting版 - 面经&感想
从6月初开始准备找工作,找了近半年,期间毁onsite无数,最近终于有所收获,拿到
几个offer,虽然不是那几个著名大公司,不能和版上的牛人比,但也算和自己专业相
近,决定挑一个从了。穷人没什么包子,就说点感想发点面经,答谢本版。顺便求祝福
接下来的process能够顺利。今年h1b已经用完了,我是打算quit phd做full time的,
学校的CPT/OPT没过qualify之前还不让full time,庆幸公司允许我先做part time。希
望一切能够顺利。也bless其他找工作的同志们。
1. 找工作还是要花大量时间精力充分准备的,各种基本概念、data structure,
algorithms, programming language concepts,还有自己简历上写的各种project要把
每个细节都弄清楚。没准备好之前不要轻易投大公司浪费机会,免得追悔莫及。我就有
惨痛的教训。一下是我主要复习的材料。
career cup
programming interview expose
ihas1337code
thecareerplus
geeks for gee... 阅读全帖
m****r
发帖数: 141
41
Design a method findEvenFreq(int[] a), which returns the single integer
value in the array which occurs with even frequency. Other numbers occur odd
numbers , which may be 7, 11 or even larger. All integers will be positive.
What if the integers are continuous.
For example, [1, 2, 3, 1] should return 1.
What if the integers may not be continuous.
example, [4, 8, 7, 5, 8 ] should return 8
The largest number can be INT_MAX.
I know how to solve it by hahstable.
Better ideas about O(1) space with O(... 阅读全帖
c**********e
发帖数: 2007
42
来自主题: JobHunting版 - 有人在玩 Facebook 的黑客杯吗?
Can anybody look at this problem? The answer seems different from mine. 我觉
得答案不对。
Facebook Hacker Cup 2011 Round 1A
First or Last
As a top driver in European racing circles, you find yourself taking more
than your fair share of risks. You go into every race knowing it may be your
last, but generally with the suspicion it won't be. Today, however, may
turn out to be different. The Fédération Internationale de l'Automobile
has sanctioned a new track in the Bernese Alps that may prove to be death o... 阅读全帖
p*****2
发帖数: 21240
43
来自主题: JobHunting版 - facebook一题
写了一个练练手。
import java.util.*;
class Node
{
Node[] children=new Node[26];

public Node Set(char c)
{
Node node=new Node();
children[c-'a']=node;
return node;
}

public Node Get(char c)
{
return children[c-'a'];
}
}
class Trie
{
Node root=new Node();

public void Add(String word)
{
int i=0;
Node node=root;
while(i {
char c=word.charAt(i);
if(node.Ge... 阅读全帖
j****b
发帖数: 108
44
来自主题: JobHunting版 - facebook一题
没想到什么特别巧的办法,brute force + hashmap?
public static void main(String[] args) {
String l[] = { "fooo", "barr", "wing", "ding", "wing" };
Map map = new HashMap();
for (int i = 0; i < l.length; i++){
if(map.containsKey(l[i]))
map.put(l[i], map.get(l[i]) +1);
else
map.put(l[i], 1);
}
String s = "lingmindraboofooowingdingbarrwingmonkeypoundcake";
int len = l[0].lengt... 阅读全帖
p*****2
发帖数: 21240
45
来自主题: JobHunting版 - facebook一题
写了一个练练手。
import java.util.*;
class Node
{
Node[] children=new Node[26];

public Node Set(char c)
{
Node node=new Node();
children[c-'a']=node;
return node;
}

public Node Get(char c)
{
return children[c-'a'];
}
}
class Trie
{
Node root=new Node();

public void Add(String word)
{
int i=0;
Node node=root;
while(i {
char c=word.charAt(i);
if(node.Ge... 阅读全帖
j****b
发帖数: 108
46
来自主题: JobHunting版 - facebook一题
没想到什么特别巧的办法,brute force + hashmap?
public static void main(String[] args) {
String l[] = { "fooo", "barr", "wing", "ding", "wing" };
Map map = new HashMap();
for (int i = 0; i < l.length; i++){
if(map.containsKey(l[i]))
map.put(l[i], map.get(l[i]) +1);
else
map.put(l[i], 1);
}
String s = "lingmindraboofooowingdingbarrwingmonkeypoundcake";
int len = l[0].lengt... 阅读全帖
l*****n
发帖数: 577
47
来自主题: JobHunting版 - 面经(L)
说实话,LinkedIn 是我面试过的相当拖拉的公司。看到不少人因电话面试3,4天就感觉
没戏了,我都忍不住地想,太着急了。以下是我的经历,相当拖拉。我写得也挺拖拉,
但希望对面试他家的朋友有所帮助。
1.初接触
在去年6月,我通过版上的一朋友推荐,到现在大概8个月了,才算结束。当然这其中也
有我的因素。
我给那朋友发了email包括我的简历,他并没有回,所以我一直不知道是有人推荐,也不
知道推荐人名字。直到后来recuiter问(可能是为了confirm reference bonus),才想
起来查以前发出的email。
recuiter到7月中旬才联系我。我还以为他在网上找到的我呢。我只在linkedin放了简
单的简历,也没有对外公开。记得但是对被发现感到比较惊奇。但是,我看了一下job
description,不很match.我就把面试推了。但是表示了对公司的强烈兴趣,并同意看看
他家其他的工作,有合适的联系他。
到十月中旬,recruiter又联系我。但是,我此时在中国,正好度一个一个月的长假。
只好在十一月再面试。面试SET position.
2.初次phone(rec... 阅读全帖
s*********d
发帖数: 2406
48
来自主题: JobHunting版 - L家phone面,悲剧
没什么好说的,还是自己不行。
第一题
abstract class absClass
{
public int AddTwoNumbers(int Num1, int Num2)
{
return Num1 + Num2;
}
public abstract int MultiplyTwoNumbers(int Num1, int Num2);
}
实例化 absclass
interviewer 说 不需要用考到任何算法知识。只考java。
answer :
public class aaClass extends absClass {
public int MultiplyTwoNumbers(int Num1, int Num2){
int multiplyresult = 0 ;
multiplyresult=Num1*Num2;

return multiplyresult;
}
这个有什么问题?
Q2:经典题
Q2:
Given a sorted 2-D array (M x N) con... 阅读全帖
X*K
发帖数: 87
49
来自主题: JobHunting版 - 讨论一个题目
靠,想来不难,但是很容易出错啊。这个算是验证过了。
public class NextPower implements Powers {
List powerList;
long previous;
public NextPower() {
powerList = new ArrayList();
reset();
}
@Override
public Long next() {
long min = Long.MAX_VALUE;
List minList = new ArrayList();
for (int i = 0; i < powerList.size(); ++i) {
int base = i + 2;
int power = powerList.get(i) + 1;
long n = (long) ... 阅读全帖
x*******5
发帖数: 152
50
来自主题: JobHunting版 - 问一道programming peals上的题
这个是我的题库,还有一些题没有coding,比如back of envelop计算,idea思考,等等
Column 4-5 Pearl (namespace Pearl)
64. Implement bitsort (Bitsort)
65 Find the k unique random integers from the range of [0,n-1] (STL, knuth,
swap, floyd) (generate_int_floyd; generate_int_swap; generate_int_knuth)
66. If memory is limited, using k-pass bitsort to sort integers (bitsort_
kpass)
67. Rotation of array (reverse, gcd, blockswap) (rotate; rotate2; rotate3)
68. Permutation of a string (without/with duplicates chars) (String::string_... 阅读全帖
首页 上页 1 2 3 4 5 6 7 8 9 10 (共10页)