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

virtu financial OA題目與答案

全局:

2024(7-9月) 码农类General 本科 全职@virtu - 网上海投 - 在线笔试  | 😐 Neutral 😐 Average | Pass | 在职跳槽

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

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

x
virtu financial OA題目與答案,求加米,新人入站辛苦海外求職中!

1.there is a box with a capacity of 5000 grams. the box may already contain some items, reducing its capacity. You'll be adding apples to that box until it is full.
Write a function that, given a zero-indexed array A consisting of N integers, representing the weight of items already in the box and each apple's weight, returns the maximum number of apples that could fit in the box without exceding its capacity.
the input array consists of an integer K as the first element, representing the sum of the weights of items already contained in the box, followed by zero or more integers represeting individual apple weights.
You may assume that A contains between 1 and 100 elements and that every number in it is between 0 and 5000.
example
input: [4650,150,150,150]
output:2

function maxApplesInBox(A) {
    const boxCapacity = 5000; // Maximum capacity of the box in grams
    const initialLoad = A[0]; // Weight of items already in the box

    // Calculate remaining capacity in the box
    let remainingCapacity = boxCapacity - initialLoad;

    // Counter for the number of apples that can fit
    let appleCount = 0;

    // Iterate over the apple weights in the array (starting from index 1)
    for (let i = 1; i < A.length; i++) {
        // Check if the current apple can fit in the remaining capacity
        if (remainingCapacity >= A[i]) {
            remainingCapacity -= A[i]; // Reduce the remaining capacity
            appleCount++; // Increment the apple count
        } else {
            break; // No more apples can fit, break the loop
        }
    }

    return appleCount;
}

2.write a function that given a string S re
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
tudents is in the range from 1 to 1000
scores are in the range from 0 to 1000
example 1
input: [1,6,3,4,3,5]
output:[1,4,4,4,4,5]

function updateScores(scores) {
    // Flag to check if any score has changed in the current iteration
    let changed;

    do {
        changed = false;
        // Create a new array to store the updated scores for this iteration
        let newScores = scores.slice();

        for (let i = 1; i < scores.length - 1; i++) {
            if (scores[i - 1] > scores[i] && scores[i + 1] > scores[i]) {
                newScores[i] = scores[i] + 1;
                changed = true;
            } else if (scores[i - 1] < scores[i] && scores[i + 1] < scores[i]) {
                newScores[i] = scores[i] - 1;
                changed = true;
            }
        }

        // Update the original scores array to the new scores after the iteration
        scores = newScores;
    } while (changed);  // Repeat as long as there was a change in the last iteration

    return scores;
}

评分

参与人数 4大米 +13 收起 理由
微信用户_iz059 + 1 赞一个
自由的火龙果 + 1 给你点个赞!
huskySV + 1 赞一个
匿名用户-DMZJV + 10 欢迎分享你知道的情况,会给更多大米奖励!

查看全部评分


上一篇:找工作网挂经
下一篇:🐶vo挂经
推荐
rukiddingme 2025-2-21 11:28:31 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

推荐
rukiddingme 2025-2-21 03:21:35 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

推荐
leisurekkk 2025-8-11 09:45:48 | 只看该作者
全局:
刚做完。一模一样的题。感谢楼主
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-91JVJ  2024-8-18 10:04:34
请问是哪个职位?
回复

使用道具 举报

🔗
 楼主| 微信用户_umhkk 2024-8-18 19:23:03 | 只看该作者
全局:

frontend UI engineer. base in NY or Dublin

评分

参与人数 1大米 +5 收起 理由
bryanjhy + 5 很有用的信息!

查看全部评分

回复

使用道具 举报

地里匿名用户
🔗
匿名用户-EEMFP  2024-11-1 22:31:50
感谢分享! 请问有后续吗?
回复

使用道具 举报

🔗
ericclei 2025-9-25 08:18:16 | 只看该作者
全局:
非常感谢楼主分享!
回复

使用道具 举报

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

本版积分规则

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