📣 黑五价提前开抢|VIP一年通行证5折,蓝莓、Offer多多同步特惠
回复: 6
跳转到指定楼层
上一主题 下一主题
收起左侧

Stripe 店面

🔗
匿名用户-EQN13  2022-2-18 00:08:26 |倒序浏览

2022(1-3月) 码农类General 博士 全职@stripe - 网上海投 - 技术电面  | 😃 Positive 🙂 Easy | Pass | 应届毕业生

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

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

x
本帖最后由 匿名 于 2022-2-17 11:23 编辑

新手求米

#
# Your previous Plain Text content is preserved below:
#
# Step 1
# Imagine an Airbnb-like vacation rental service, where users in different cities can exchange their apartment with another user for a week. Each user compiles a wishlist of the apartments they like. These wishlists are ordered, so the top apartment on a wishlist is that user's first choice for where they would like to spend a vacation. You will be asked to write part of the code that will help an algorithm find pairs of users who would like to swap with each other.
#
# Given a set of users, each with an *ordered* wishlist of other users' apartments:
#
# a's wishlist: c d
# b's wishlist: d a c
# c's wishlist: a b
# d's wishlist: c a b
#
# The first user in each wishlist is the user's first-choice for whose apartment they would like to swap into.
# Write a function called has_mutual_first_choice() which takes a username and returns true if that user and another user are each other's first choice, and otherwise returns false.
#
# has_mutual_first_choice('a') // true (a and c)
# has_mutual_first_choice('b') // false (b's first choice does not *mutually* consider b as their first choice)
#
# Then expand the base case beyond just "first" choices, to include all "mutually rank
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
result of the change. Note that, as before, the
# username and rank passed in identify the entry whose rank is being bumped up, so (a, 1) would refer to a's second-choice.
#
# // if b's third choice becomes their second choice, b and c will no longer be a mutually-ranked anti-pairing
# changed_antipairings('b', 2) // returns ['c']
#
# // if a's second choice becomes their first choice, a and c will be no longer be a mutually ranked anti-pairing
# // in addition, a and d will become a mutually ranked anti-pairing (the second-to-last choice of each other)
# changed_antipairings('a', 1) // returns ['c', 'd']

































评分

参与人数 5大米 +18 收起 理由
hty + 1 给你点个赞!
bluejay + 1 很有用的信息!
cxb1027 + 2 给你点个赞!
匿名用户-4PMMC + 13
katong0 + 1 很有用的信息!

查看全部评分


上一篇:确实 SDE intern karat+白板 面经
下一篇:两个🐎新鲜OA
地里匿名用户
推荐
匿名用户-EQN13  2022-2-18 00:13:39
好人一生平安
回复

使用道具 举报

🔗
dragonfly123 2022-2-18 01:31:56 | 只看该作者
全局:
感谢LZ分享,加油!
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-V6WVD  2022-2-18 07:53:09
很新鲜呐。
感谢分享
回复

使用道具 举报

🔗
XZH 2022-3-10 09:40:38 | 只看该作者
全局:
感谢分享!
但我想说条纹出题感觉跟阅读理解似的。。。我要是碰到了读题都要花好久
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-XVYVC  2022-3-13 05:26:09
看懂题花了半小时...
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-0YEV4  2022-3-18 17:23:08
非常感谢楼主啊,祝你offer 多多
回复

使用道具 举报

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

本版积分规则

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