由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - amazon interview
相关主题
这题怎么做?求指点一下我写的程序哪部分是C++ syntax
题目: string pattern matching w/ wildcard (.*)弱问:不好意思,这个CODE问题在哪里?
Facebook phone screen白板代码,支持O(1)时间GetMin的stack
分享:non-recursive breadth first search and depth first search algorithm in C菜鸟求救 请大家看看我的代码有没有问题
谁能写个trie的框架?问个apple的面试的问题
问个Print null的问题C语言高手帮我看看下面代码,哪里错了啊,谢了
leetcode上的Sort List那道题求救! Copy List With Random Pointer总是超时
面筋写了个atoi,大家帮看有没有哪里错了?
相关话题的讨论汇总
话题: action话题: remotecall话题: retry话题: times话题: max
进入JobHunting版参与讨论
1 (共1页)
s******e
发帖数: 108
1
update:
收到invite onsite 通知,恩,国人还是挺靠谱的。感谢。
感谢NND的推荐,
不过可能被interviewer的国人给干掉了.
1.经典的stream求median,用2个heap解决。
2.给了一段程序,说一下程序的功能,
然后比较c程序和javascrip程序的区别。这个down掉。
#include
#include
#include
#include
#define MAX_RETRY 3
int remoteCall() {
return random() % 2;
}
void action(times) {
printf("calling remote procedure\n");
if (remoteCall()) {
printf("success!\n");
} else {
printf("error occured!\n");
if (times < MAX_RETRY) {
sleep(1);
action(times + 1);
} else {
printf("max retry reached\n");
}
}
}
int main(void) {
int numRetry = 0;
srand(time(NULL));
action(1);
return 0;
}
--------------------------------------------------------
------
js
--------------------------------------------------------
------
var action,
maxTimes = 3;
function remoteCall(cb) {
if (Math.floor(Math.random() * 2) === 0) {
cb("error occured!");
} else {
cb();
}
}
action = function (times) {
return function () {
console.log("calling remote procedure");
remoteCall(function (error) {
if (error) {
console.log(error);
if (times < maxTimes) {
setTimeout(action(times + 1), 1000);
} else {
console.log("max retry reached");
}
} else {
console.log("success!");
}
});
};
};
action(1)();
q****x
发帖数: 7404
2
so what's the diff? have you mentioned js on resume?

【在 s******e 的大作中提到】
: update:
: 收到invite onsite 通知,恩,国人还是挺靠谱的。感谢。
: 感谢NND的推荐,
: 不过可能被interviewer的国人给干掉了.
: 1.经典的stream求median,用2个heap解决。
: 2.给了一段程序,说一下程序的功能,
: 然后比较c程序和javascrip程序的区别。这个down掉。
: #include
: #include
: #include

S**I
发帖数: 15689
3
应该是吧,A家问JS,我还是头一次听说。

【在 q****x 的大作中提到】
: so what's the diff? have you mentioned js on resume?
f*******t
发帖数: 7549
4
没看出两段程序有什么区别,除了C和js语法本身的区别
q******8
发帖数: 848
5
这个是啥:
经典的stream就median,用2个heap解决
b*******y
发帖数: 232
6
最大堆,最小堆吧

【在 q******8 的大作中提到】
: 这个是啥:
: 经典的stream就median,用2个heap解决

q******8
发帖数: 848
7
题目是什么?

【在 b*******y 的大作中提到】
: 最大堆,最小堆吧
b*******y
发帖数: 232
8
应该是输入一序列数字,求medium
用最大堆和最小堆维持当前情况下的数字按照数值大小对半分
每输入一个新的数字,对最大堆最小堆作相应处理

【在 q******8 的大作中提到】
: 题目是什么?
B******5
发帖数: 4676
9
online numbers stream, keep the median updated

【在 q******8 的大作中提到】
: 题目是什么?
1 (共1页)
进入JobHunting版参与讨论
相关主题
写了个atoi,大家帮看有没有哪里错了?谁能写个trie的框架?
看atoi代码很麻烦,不如讨论讨论test case吧问个Print null的问题
leetcode上遇到的问题leetcode上的Sort List那道题
Leetcode Copy List with Random Pointer Runtime Error?面筋
这题怎么做?求指点一下我写的程序哪部分是C++ syntax
题目: string pattern matching w/ wildcard (.*)弱问:不好意思,这个CODE问题在哪里?
Facebook phone screen白板代码,支持O(1)时间GetMin的stack
分享:non-recursive breadth first search and depth first search algorithm in C菜鸟求救 请大家看看我的代码有没有问题
相关话题的讨论汇总
话题: action话题: remotecall话题: retry话题: times话题: max