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

[面试经验] AWS SDE I OA 真题和题库

🔗
匿名用户-GRXE3  2025-1-10 13:00:02 |倒序浏览

2024(10-12月) 码农类General 博士 全职@Amazon - 网上海投 - Onsite  | 😐 Neutral 😐 Average | Fail | 在职跳槽

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

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

x

我自己OA(10/2024)做到的两道题,和之前论坛里面的题我总结了一下。

  • Generate Lexicographically Smallest String



Developers at Amazon are working on a test generation utility for one of their new products.


Currently, the utility generates only speical strings. A string is special of there are no matching adajecnt characters. Given a string of length n,
generate a special string of length n that is lexicographically greater than s. If multiple such special strings are possible, then return the lexicographically smallest string among them.


Notes:
1. Special String: A string is special if there are no two adjacent characters that are the same.
2. Lexicographical Order: This is a generalization of the way words are alphabetically ordered in dictionaries. For example, "abc" is lexicographically smallest than "abd" because "c" comes before "d" in the alphabet.


A string a is lexicographically smaller than a string b if and only if one of the following holds:
1. a is a prefix of, but a is not equal to b. For example, "abc" is smaller than "abcd"
2. in the first position where a and b differ, the character in a comes before the character in b in the alphabet.
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
;1" characters.
2. A string A is a substring of a string B if A can be obtained from B by deleting several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) chracters from the end.


Example
music = "1001"
k = 1


By flipping the third chracter, the string becomes music = "1011". The longest alternating music string in this modified string is "101", which spans from the 0th index to the 2nd index and has a length of 3. With only oen operation, it is not possible to obtain a longer alternating binary subtring. Thus, the answer is 3.


Function Description
Complete the function getMaximumAlternatingMusic.


getMaximumAlternatingMusic has the following parameters:
1. string music: a string of characters 0 and 1.
2. int k: the number of operations allowed.


如果大家觉得有用,烦请大家给个大米吧!(不会消耗自己原有大米的)!谢谢

评分

参与人数 9大米 +23 收起 理由
李白的天马行空 + 1 很有用的信息!
easymoney + 1 很有用的信息!
人工很智障 + 1 很有用的信息!
kathy789 + 1 给你点个赞!
Dex97 + 1 功德无量

查看全部评分


上一篇:Robinhood 电面
下一篇:snapchat一面挂经
全局:

上面题库的一些题目截图

本帖子中包含更多资源

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

x

评分

参与人数 1大米 +1 收起 理由
微信用户_hv5ez + 1 赞一个

查看全部评分

回复

使用道具 举报

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

本版积分规则

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