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

Twitch 前端 Front End OA 面經

全局:

2020(1-3月) FrontEndEng 本科 全职@twitch - 猎头 - 在线笔试  | | Pass | 在职跳槽

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

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

x
Twitch Online OA 總共 3題希望對各位朋友有幫助:

1. 考prototype:


You are given an array A consisting of N integers. Your task is to return an array of N objects that share the same prototype, each of whom should have a "value()" method, which called on i-th object should return the integer A[i].

The "value()" method of all objects must be the same method and it cannot be an own property of those objects (for an object O the following O.hasOwnProperty('value') should be false).

Write a function "solution" such that, given an array A of N integers, returns an array T of N JavaScript objects. For any two indices i, j < N, the following conditions should be true:

    T[j].value() === A[j]
    T[i].value === T[j].value
    !T[i].hasOwnProperty('value')
    !T[j].hasOwnProperty('value')

where T = solution(A).

For example, given A = [4, 2], your function should return such array T, that

    T[0].value() === 4
    T[1].value() === 2
    T[0].value === T[1].value
    !T[0].hasOwnProperty('value')
    !T[1].hasOwnProperty('value')</tt>

Assume that:

- N is an integer within the range 1 to 200
- each element of array A is an integer within the range −9,007,199,254,740,991 to 9,007,199,254,740,991

In your solution, focus on correctness. The performance of your solution will not be the focus of the assessment.


您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
sed, any one of them could be chosen.
Write a function:

function solution(S) such that, given a string S consisting of N characters, returns any string that can result from a sequence of transformations as described above.


For example, given string S = "ACCAABBC" the function may return "AC", because one of the possible sequences of transformations is as follows:

ACCAABBC -> AAABBC -> ABBC -> AC

Also, given string S = "ABCBBCBA" the function may return "", because one possible sequence of transformations is:

ABCBBCBA -> ABCCBA -> ABBA -> AA -> ""

Finally, for string S = "BABABA" the function must return "BABABA", because no rules can be applied to string S.
Write an efficient algorithm for the following assumptions:

string S consists only of the following characters: "A", "B" and/or "C".

评分

参与人数 2大米 +21 收起 理由
metrical1 + 1 给你点个赞!
匿名用户-EORXO + 20

查看全部评分


上一篇:soundhound电面
下一篇:蜂巢 SDE 店面
🔗
marty_wang 2020-8-31 04:52:54 | 只看该作者
全局:
#3

const process = (str) => {
  let i = 0;
  
  while(i<str.length-1) {
    if(str[i] === str[i+1]) {
      str = str.slice(0, i) + str.slice(i+2);
      i = Math.min(i-1, 0);
    } else {
      i++
    }
  }
  
  return str;
};
回复

使用道具 举报

🔗
yejiada 2020-9-4 03:31:25 | 只看该作者
全局:
有后续面经吗 我过几天有个面试
回复

使用道具 举报

🔗
zclmonica 2020-9-15 14:09:05 | 只看该作者
全局:
yejiada 发表于 2020-9-4 03:31
有后续面经吗 我过几天有个面试

想问问你做codility了吗?
回复

使用道具 举报

🔗
COOKIE07 2020-9-30 03:36:22 | 只看该作者
全局:
有没有电面的面经~
回复

使用道具 举报

🔗
metrical1 2021-3-7 13:45:28 | 只看该作者
全局:
这第一题,啥意思。没太明白
回复

使用道具 举报

🔗
小鱼二 2022-4-13 17:20:19 | 只看该作者
全局:
同前端 求加微信交流一下 694537055
回复

使用道具 举报

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

本版积分规则

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