<
回复: 6
收起左侧

Amazon NG OA

本楼:   👍  1
100%
0%
0   👎
全局:   1
100%
0%
0

2024(1-3月) 工程类 本科 全职@amazon - Other - 在线笔试  | 😐 Neutral 😣 HardWaitList | 应届毕业生
Hello,

I am writing in english because I am a foreigner.

I've had my Amazon NG OA today(70 minutes with 2 coding questions).
The first question was similar to leetcode 438 "find all anagrams in a String".


The second question I will post here:
"Amazon has multiple delivery centers for the distribution of its goods. In one such center, parcels are arranged in a sequence where the i parcel has a weight of weight[i]. A shipment is constituted of a contiguous segment of parcels in this arrangement. That is, for 3 parcels arranged with weights 3, 6, 3, a shipment can be formed of parcels with weights 3 6 3 3,6 6, 3 and 3, 6, 3 but not with weights 3, 3. These shipments are to be loaded for delivery and must be balanced. A shipment is said to be balanced if the weight of the last parcel of the shipment is not the maximum weight among all the weights in that shipment. For example, shipment with weights 3,9, 4,7 is balanced since the last weight is 7, while the maximum shypment weight is 9. However, the shipment 4, 7, 2, 7 is not balanced. Given the weights of n parcels placed in a sequence, find the maximum number of shipments that can be formed such that each parcel belongs to exactly one shipment, each shipment consists of only a contiguous segment of parcels, and each shipment is balanced. If there are no balanced shipments, return 0. Code Question 2 Amazon has multiple delivery centers for the distribution of its goods. In one such cen
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
anced. Given the weights of n parcels placed in a sequence, find the maximum number of shipments that can be formed such that each parcel belongs to exactly one shipment, each shipment consists of only a contiguous segment of parcels, and each shipment is balanced. If there are no balanced shipments, return 0."


Which left me with my mind blank.
Any idea how to solve this ?

本帖子中包含更多资源

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

x

评分

参与人数 3大米 +7 收起 理由
z1z2z3z4 + 1 给你点个赞!
uilnauy + 1 给你点个赞!
清道神君 + 5 欢迎分享你知道的情况,会给更多大米奖励!

查看全部评分


上一篇:pinterest MLE 四轮挂经
下一篇:波士顿MERL phd intern 面经
地里匿名用户
匿名用户-CGQ2Z  2024-3-2 04:59:33
本楼:   👍  1
100%
0%
0   👎
Hello, can I ask a question?
For single weight in one shipment like [3], or [6], are they considered non-balanced? Given the example [3,6,3] above, the return value would be 2, can you please confirm that? ([6,3], [3,6,3])

To me, it looks like finding the max value in a sliding window, and then making sure it's not equal to the last element from the window. (Leetcode 239 - Sliding Window Maximum)
回复

使用道具 举报

WuW雨馨WuW 2024-3-1 12:38:03 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   1
33%
67%
2
looks hard.
回复

使用道具 举报

terranzmczmx 2024-3-1 15:48:06 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   76
100%
0%
0
What's the size of the input?
回复

使用道具 举报

 楼主| ciocanitoru30 2024-3-1 19:09:00 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   1
100%
0%
0
Length of the array <= 10^5
回复

使用道具 举报

 楼主| ciocanitoru30 2024-3-1 19:09:25 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   1
100%
0%
0
Each weight <= 10^9
回复

使用道具 举报

 楼主| ciocanitoru30 2024-3-6 03:06:28 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   1
100%
0%
0
匿名用户 发表于 2024-3-1 22:59
Hello, can I ask a question?
For single weight in one shipment like [3], or [6], are they considere ...

Yes, I think that it how it should have been solved.
回复

使用道具 举报

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

本版积分规则

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