Amazon Online Assessment 2024 | Amazon oa | amazon oa一亩三分地

亚麻最近的OA题目,让我们一起来看下吧~

Let’s take a look at the recent Amazon OA questions for flax together~

题目1:减少礼品

确定要从价格数组中移除的项目的最小数量,使得任何k个项目的价格之和不超过阈值。
注意:如果列表中的项目数小于k,则无需再删除任何项目。

Reduce gifts determine the minimum num of items to remove from an array of prices so that the sum of prices of any k items does not exceed a threshold.Note: if the number of items in the list is less than k, then there is no need to remove any more items.

Understanding the Problem:

  • You have an array of prices.
  • You need to ensure that the sum of prices of any k items does not exceed a given threshold.
  • If the number of items in the list is less than k, then no removal is necessary.

Input and Output:

  • Input: An array of prices, an integer k, and an integer threshold.
  • Output: The minimum number of items to remove.

Approach:

  • Sort the array of prices in descending order to prioritize higher prices that contribute more to the sum.
  • Calculate the sum of the top k items.
  • If the sum exceeds the threshold, remove items starting from the highest prices until the sum of any k items is less than or equal to the threshold.
  • Track the number of items removed to achieve the required condition.

Algorithm:

  • Sort the array of prices in descending order.
  • Calculate the sum of the first k items.
  • If the sum exceeds the threshold, remove the highest-priced items until the sum of any k items is less than or equal to the threshold.
  • Return the count of removed items.

题目2:云计算

AWS是一个拥有多个服务器的云计算平台。其中一台服务器被分配来满足客户的请求。有n个客户请求按顺序排列在一个队列中,其中第i个请求的最大等待时间由wait[i]表示也就是说,如果第i个请求在等待[i]秒内没有得到服务,则该请求将过期并从队列中删除。服务器按照FIFO原则处理请求。首先处理第一个请求,最后提供第n个请求。

在每一秒,队列中的第一个请求都会被处理。下一秒,已处理的请求和任何过期的请求都将从队列中删除。给定由数组等待表示的每个请求的最大等待时间,找出队列中每秒出现的请求数,直到它为空。

注意:如果请求在某个时刻t被送达,则该请求将在该时刻被计数,并在下一时刻被删除。第一个请求在时间=0时处理。当time=wait[i]时,请求过期而未得到处理。它必须在时间小于wait[i]时处理。初始队列按照必须处理的顺序表示时间=0时的所有请求。
Amazon Web Services (AwS) is a cloud computing platform with multiple servers.One of the servers is assigned to serve customer requests. There are n customer requests placed sequentially in a queue,
where the i^th request has a maximum waiting time denoted by wait[i].That is, if the i^th request is not served within wait[i] seconds,then the request expires and it is removed from the queue.

The server processes the request following the First in First Out (FIFO) principle.The 1st request is processed first, and the nth request is served last.At each second, the first request in the queue is processed.At the next second, the processed request and any expired requests are removed from the queue.

Understanding the Problem:

  • You have a list of customer requests, each with a specific maximum waiting time.
  • Requests are placed sequentially in a queue.
  • If a request is not served within its waiting time, it expires and is removed from the queue.

Input and Output:

  • Input: A list wait where wait[i] represents the maximum waiting time for the i-th request.
  • Output: The number of requests successfully served before they expire.

Approach:

  • Use a priority queue (min-heap) to keep track of the expiration times of requests.
  • Simulate the server processing each request, updating the current time.
  • For each request, if the current time is less than its expiration time, serve it and update the current time.
  • If the current time exceeds the expiration time of the next request in the queue, remove it as it has expired.

Algorithm:

  • Initialize a priority queue.
  • Iterate through the list of requests, calculating the expiration time for each and adding it to the priority queue.
  • Serve requests in the order of their expiration times.
  • Count the number of requests successfully served.


经过我们的强力面试辅助,OA代写,候选人通过这些面试题的解析和沟通,面试官不仅了解了候选人的编程能力,也看到了我在解决问题过程中清晰的思路和有效的沟通技巧。这些不仅有助于应对 Meta 的面试,同时也能提升我们解决实际编程问题的能力。祝大家面试顺利!

如果你也需要我们的面试辅助服务,请立即联系我们
Through our strong interview assistance and OA ghostwriting, the candidate not only understood their programming skills but also saw my clear thinking and effective communication skills in problem-solving through the analysis and communication of these interview questions. These not only help us cope with Meta interviews, but also enhance our ability to solve practical programming problems. And Wishing everyone a smooth interview!

If you have any questions or would like to discuss these problems further, contact us!

author avatar
azn7u2@163.com

One Reply to “Amazon Online Assessment 2024 | Amazon oa | amazon oa一亩三分地”

  1. Your blog is a constant source of inspiration for me. Your passion for your subject matter is palpable, and it’s clear that you pour your heart and soul into every post. Keep up the incredible work!

Leave a Reply

Your email address will not be published. Required fields are marked *