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

面试经验 Uber senior backend developer

🔗
匿名用户-H7PCH  2025-5-7 21:38:50 |倒序浏览

2025(1-3月) 码农类General 硕士 全职@uber - 猎头 - 技术电面  | 😃 Positive 😐 Average | Pass | 在职跳槽

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

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

x
这个面试官居然是在机场的lounge 里面给我面试的,估计是去哪儿玩了,他介绍了自己的工作,让我介绍一下自己

然后就问了一个类似1710的题目



selecting items from a menu.

You have a specific budget, and your goal is to get the maximum amount of calories that can be bought

with this budget.



Input:

A list of doubles representing the dollar prices of items (example: 1.25 for $1.25)

A list of integers representing the calories value of each item in the same order as prices.

A double representing your budget in dollar amount (example: 20.00 for $20)



Output:

An integer representing the maximum amount of calories that can be bought

without going over the budget.

比较有意思的是,我程序快写出来的时候,面试官居然喜人的给了我一组test case, 让我跑一下. 其中有一个test case

我居然就是过不了, 他是非常的得意,说不过没事,让我问一些感兴趣的问题,







    public static void main(String[] args) {

        Solution solution = new Solution();

        List<Integer> calories;

        List<Double> prices;

        Double budget;

        Integer max;

        //can repeat same item
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
dget).equals(max)) {

            System.out.println("Passed TEST CASE 6");

        } else {

            System.out.println("Failed TEST CASE 6");

        }



        // TEST CASE 7

        calories = Arrays.asList(100);

        prices = Arrays.asList(1.20);

        budget = 6.00;

        // maximum item inidices: 0 five times.

        max = 500;

        if (solution.maximumMenuCalories(calories, prices, budget).equals(max)) {

            System.out.println("Passed TEST CASE 7");

        } else {

            System.out.println("Failed TEST CASE 7");

        }

    }

评分

参与人数 2大米 +16 收起 理由
匿名用户-X8VSH + 15 欢迎分享你知道的情况,会给更多大米奖励!
Mikael + 1 给你点个赞!

查看全部评分


上一篇:[面试经验] TikTok backend
下一篇:有没有最近在面硬币基地emerging talent的以及我的timeline
地里匿名用户
🔗
匿名用户-CIWBN  2025-5-27 03:39:18
本帖最后由 匿名 于 2025-5-26 15:51 编辑

这有点像背包问题,但是背包问题要求price, value是整数,这个题确实float.
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-T4CL8  2025-10-20 15:43:25
匿名用户 发表于 2025-5-26 12:39
这有点像背包问题,但是背包问题要求price, value是整数,这个题确实float.

可以乘以100就变成整数了
回复

使用道具 举报

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

本版积分规则

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