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

Akuna Capital coding 题目

全局:

2022(4-6月) 码农类General 硕士 全职@akunacapital - 网上海投 - HR筛选  | 🙁 Negative 🙂 Easy | Fail | 在职跳槽

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

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

x


1. Order Matching Engine C#

You're going to write an exchange order matching engine.
The input is from stdin. Each line has several columns separated by one space.
The first column specifies the operation to be done. Our supported operations are:
BUY
SELL
CANCEL
MODIFY
PRINT
If the first column is BUY or SELL, then this line has five columns in total:
The second column is the order type, it's either "IOC" or "GFD".
The third column is the price you want to buy or sell, it's an integer.
The fourth column shows the quantity of that buy or sell, it's an integer. Both the price and quantity are positive numbers.
The fifth column is the order id which is an arbitrary word.
If the first column is CANCEL, then this line has two columns in total:
1.         The second column is the order id.
This order needs to be deleted, it can't be traded any more. If the provided Order ID doesn't exist then do nothing.
If the first column is MODIFY, then this line has five columns in total:
1.        The second column is the order id, it means that order needs to be modified.
2.        The third column is either BUY or SELL.
3.        The fourth column is the new price of that order.
4.        The fifth column is the new quantity of that order.
If the provided Order ID doesn't exist then do nothing.
(Note: that we can't modify an IOC order type, as we'll mention later.)
MODIFY is a powerful operation, e.g. a BUY order can be modified to a SELL order:
BUY GFD 1000 10 order1
MODIFY order1 SELL 1000 10
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
ch is implemented cleanly and in a straightforward manner.
3. Performance: Consider the performance of the methods you write and the data structures you choose. Marks will be deducted for inefficiencies.
Examples
Example 1:
BUY GFD 1000 10 order1
PRINT
Output:
SELL:
BUY:
1000 10
Example 2:
BUY GFD 1000 10 order1
BUY GFD 1000 20 order2
PRINT
Output:
SELL:
BUY:
1000 30
Example 3:
BUY GFD 1000 10 order1
BUY GFD 1001 20 order2
PRINT
Output:
SELL:
BUY:
1001 20
1000 10
Example 4:
BUY GFD 1000 10 order1
SELL GFD 900 20 order2
PRINT
Output:
TRADE order1 1000 10 order2 900 10
SELL:
900 10
BUY:
Example 5:
BUY GFD 1000 10 ORDER1
BUY GFD 1010 10 ORDER2
SELL GFD 1000 15 ORDER3
Output:
TRADE ORDER2 1010 10 ORDER3 1000 10
TRADE ORDER1 1000 5 ORDER3 1000 5
















































评分

参与人数 1大米 +11 收起 理由
匿名用户-1EDX3 + 11

查看全部评分


上一篇:吴波儿新鲜店面挂经
下一篇:Verily Onsite
🔗
小咸马 2022-5-16 11:47:31 | 只看该作者
全局:
请问楼主 这个OA是两个小时做这一道题吗~
回复

使用道具 举报

🔗
 楼主| OnePlus 2022-5-16 11:57:29 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
回复

使用道具 举报

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

本版积分规则

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