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 的大作中提到】 : 题目是什么?
|