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

亚麻新鲜面经+自己的答案

🔗
匿名用户-QJXUM  2024-10-26 06:51:05 |倒序浏览

2024(10-12月) 码农类General 硕士 全职@Amazon - 网上海投 - 技术电面  | 😐 Neutral 😣 Hard | Other | 在职跳槽

今天刚做完,自己粗心,之前没有做好功课,做完网上搜才发现有人好像做过类似的题目,并附上自己的答案


题目大概是:


A user is using the Amazon fitness tracker, and they are engaged in a  jumping exercise routine. The user is positioned on the ground, and  there are nnn stones, each placed at different heights. The height of  the iii-th stone is represented by height[i] meters.
The goal is to maximize the calorie burn during this exercise, and  the calories burned when jumping from the iii-th stone to the jjj-th  stone is calculated as:(height[i]−height[j]) *({height}[i] - {height}[j])
The user intends to practice jumping on each stone exactly once but  can choose the order in which they jump. Since the user is looking to  optimize their calorie burn for this single session, the ta
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
dd(new ArrayList<>(path));
                        return;
                }
                for(int i=startIndex; i<n; i++) {
                        path.add(height[i]);
                        backtracking(n, startIndex+1, height);
                        path.removeLast();
                }
        }
       
        public static long getCalories(int[] height) {
                long cal = height[0]*height[0];
                for(int i=1; i<height.length; i++) {
                        cal += (height[i]-height[i-1])*(height[i]-height[i-1]);
                }
                return cal;
        }
       



本帖子中包含更多资源

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

x

评分

参与人数 4大米 +14 收起 理由
han1171995 + 2 很有用的信息!
匿名用户-BXFJF + 10 欢迎分享你知道的情况,会给更多大米奖励!
EleanorLiu + 1 赞一个
samjop + 1 给你点个赞!

查看全部评分


上一篇:Morgan Stanley summer 2025 Hirevue面试
下一篇:Jane Street QR 一面店面面经 以及二面时间问题
推荐
Falldawn 2024-10-26 10:48:49 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

推荐
Sparke 2024-11-9 00:54:13 | 只看该作者
全局:
wow这题是我OA的第一题,greedy(先排序然后左右横跳)应该就是最佳解。
回复

使用道具 举报

推荐
zhiyazw 2024-10-26 10:13:48 | 只看该作者
全局:
这个题是不是可以排序后贪心:ground->n-1->0->n-2->1...
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-QJXUM  2024-10-26 06:51:36
刷题不多,时间感觉很赶很赶
回复

使用道具 举报

全局:
楼主是oa还是vo啊
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-QJXUM  2024-10-26 11:43:35

oa








8个字
回复

使用道具 举报

🔗
okhere191 2024-10-26 11:53:46 | 只看该作者
全局:
现在题都出这么抽象。题都要读半天。
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-TO11U  2024-10-26 14:48:38
okhere191 发表于 2024-10-26 11:53
现在题都出这么抽象。题都要读半天。

我也是读了好几遍才看懂
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-QJXUM  2024-10-26 15:07:31
Falldawn 发表于 2024-10-25 22:48
这题如果用permutation做法,可以参考LC 47的做法,但是我感觉这是greedy算法

具体算法如下:

感谢, 我用排序后贪心算法写了一遍,时间复杂度小很多
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-QJXUM  2024-10-26 15:49:35
能给点大米吗
回复

使用道具 举报

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

本版积分规则

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