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

热带雨林八月oa 总结

🔗
匿名用户-VJ6MD  2021-9-13 23:18:12 |倒序浏览

2021(7-9月) 码农类General 硕士 全职@amazon - 网上海投 - 在线笔试  | 😐 Neutral 🙂 Easy | Pass | 在职跳槽

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

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

x
分享8月亚麻oa 准备材料,考到的题目全在里面。 9月可能出了新题了,大家有备无患。路过求加米 谢谢
parking lot
You are given an List of positions of cars as to where they are parked. You are also given an integer K.
The cars needs to be covered with a roof. You have to find the minimum length of roof that takes to cover K cars.

Input : 12,6,5,2      K = 3

Explanation :  There are two possible roofs that can cover K cars. One that covers the car in 2,5,6 parking spots and
another roof which covers 5,6,12 parking spots. The length of these two roofs are 5 and 8 respectively. Return 5
since that's the roof with minimum length that covers K cars.

Output : 5


a=[3,5,7,8,9,53,67,124]
k=6
if not partking_spots or k==0:
return 0
if k > len(parking_spots):
return float('inf')

a.sort()
x=0
minLength=float('inf')
for idx,num in enumerate(a):
    if idx-x+1==k:
        minLength=min(minLength,num-a[x]+1)
        x+=1

print(minLength)
Decode the input string into original string.
You are given an encoded string  and number of rows, Convert it to original string

Input: mnesi___ya__k____mime  N = 3

Output : my name is mike

Explanation : Read the matrix in a diagonal way starting from [0][0] index until the end of row and start from the top
again to decode it. _ are treated as space.

m n e s i _  _

  _ y a _ _ k _

  _ _ _ m i m e

def build_matrix(input_string, mat_size):
    matrix = []
    num_chars_per_row = len(input_string) // mat_size

    for i in range(0, len(input_string), num_chars_per_row):
        row = list(input_string[i:i + num_chars_per_row])
        matrix.append(row)

    return matrix

# Question: Are the leading spaces in the output to be removed?
def decode_input_string(input_string, mat_size):
    # Input Validations...
    if not input_string: return ""

    ma
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
lections.Counter(a)
    if abs(freq["("]-freq[")"])+abs(freq["["]-freq["]"])>freq["?"]:
        return None

    countRound,countSquare,countQuestion=0,0,0
    for c in a:
        if c=="(":
            countRound+=1
        elif c==")":
            countRound-=1
        elif c=="[":
            countSquare+=1
        elif c=="]":
            countSquare-=1
        elif c=="?":
            countQuestion+=1

        if abs(countRound) + abs(countSquare) <= countQuestion:
            # left is correct
            res+=1

    return res-1
leftsum bigger than rightsum



compress priority

put in hashmap, then sort into a list.

Secret array
need to +1; need to return 0


Demolition Robot

Amazon Fresh Deliveries
reorder data in log files L937
Clear path in matrix L1901


评分

参与人数 4大米 +6 收起 理由
葡萄的奶茶 + 2
heavenevil + 1 很有用的信息!
1227. + 1 赞一个
tttooz + 2 给你点个赞!

查看全部评分


上一篇:卖力 AMTS OA 新鲜
下一篇:2022 ng 🐶 oa
🔗
KaiHHEW 2021-9-16 01:27:32 | 只看该作者
全局:
祝楼主顺利
回复

使用道具 举报

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

本版积分规则

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