回复: 1
跳转到指定楼层
上一主题 下一主题
收起左侧

唔布跪经

全局:

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x


两轮店面,第一轮没写对,思路错了(后来发现是裂口原题),感谢第一轮中国大哥高抬贵手,又安排了第二轮。但第二轮很扯,不知道是不是听说我写过前端,出了个从来没见过的题,直接交了个白卷,还请知道思路的题友指点一二。

第一轮题目如下:

// This is the text editor interface.
// Anything you type or change here will be seen by the other person in real time.
//call stack profiling,
/*
logs
enter func1 ts1
enter func2 ts2
exit func2 ts3
exit func1 ts4

question, what is exclusive time used by a function (e.g fnc1)
func1 ts4 - ts1 - ( ts3 - ts2)

input list of logs, records enter/exits time of funcitons
output will be exclustive time used by a "given&qu
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
n(msg) {    console.log(`got "${msg}", happyBirthdayGreet should have been called once and was called ${greetingCalled} time(s)`)    bd('Anne', 31, function(msg) {      console.log(`got "${msg}", happyBirthdayGreet should have been called twice and was called ${greetingCalled} time(s)`)    })  })})%希望对准备面试的有所帮助!



评分

参与人数 1大米 +5 收起 理由
lihannan + 5 很有用的信息!

查看全部评分


上一篇:FB 电面
下一篇:Oracle Bare Metal Cloud 电面
🔗
 楼主| wsgis 2017-11-19 14:06:44 | 只看该作者
全局:
第二题不知为啥格式有问题。

// This is the text editor interface.
// Anything you type or change here will be seen by the other person in real time.

// memoization: (x, y) => x + y

// fs.readFile('foo.txt', function(text) {})
// var memoizedReadFile = asyncMemoize(fs.readFile)
// memoizedReadFile('foo.txt', function(text) {}) // hits disk, caches result, and calls callback
// memoizedReadFile('foo.txt', function(text) {}) // only returns cache
// memoizedReadFile('bar.txt', function(text) {}) // hits disk




/**
* fn: asyncrounous function where the last argument is a callback
* (a function taking one argument that is a result)
*
* Given a function, return another function that when it is called
* with the same parameters (sans callback) of a previous invocation,
* does not call the original `fn` but "immediately" callbacks with
* with the cached result.
*/
function asyncMemoize(fn) {

}

var keyObject={
    String funName;
    ArrayList<Object> params;
}

// test cases
var greetingCalled = 0
var happyBirthdayGreet = function(person, age, cb) {
  greetingCalled++
  setTimeout(() => cb(`Happy ${age}${{1:'st', 2:'nd'}[age % 10] || 'th'} Birthday ${person}!`), 800)
}

var bd = asyncMemoize(happyBirthdayGreet)

bd('Bob', 24, function(msg) {
  console.log(`got "${msg}", happyBirthdayGreet should have been called once and was called ${greetingCalled} time(s)`)
  bd('Bob', 24, function(msg) {
    console.log(`got "${msg}", happyBirthdayGreet should have been called once and was called ${greetingCalled} time(s)`)
    bd('Anne', 31, function(msg) {
      console.log(`got "${msg}", happyBirthdayGreet should have been called twice and was called ${greetingCalled} time(s)`)
    })
  })
})%

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表