CS-OA cs-vo Faang

Amazon Channel Packet Distribution Optimization – 亚马逊OA-服务器通道数据包分配优化算法 -Amazon Coding Challenge Walkthrough-最少移动次数以排序重量块 – 亚马逊编程挑战解析-亚马逊OA- Amazon OA

Channel Packet Distribution Optimization

Amazon's AWS provides fast and efficient server solutions. The developers want to stress-test the quality of the servers' channels. They must ensure the following:

  • Each of the packets must be sent via a single channel.
  • Each of the channels must transfer at least one packet.

The quality of the transfer for a channel is defined by the median of the sizes of all the data packets sent through that channel.

Note: The median of an array is the middle element if the array is sorted in non-decreasing order. If the number of elements in the array is even, the median is the average of the two middle elements.

Find the maximum possible sum of the qualities of all channels. If the answer is a floating-point value, round it to the next higher integer.

packets = [1, 2, 3, 4, 5]
channels = 2

At least one packet has to go through each of the 2 channels. One maximal solution is to transfer packets {1, 2, 3, 4} through channel 1 and packet {5} through channel 2.

The quality of transfer for channel 1 is (2 + 3)/2 = 2.5 and that of channel 2 is 5. Their sum is 2.5 + 5 = 7.5 which rounds up to 8.

Function Description:
Complete the function findMaximumQuality in the editor below.

findMaximumQuality has the following parameters:

  • int packets[n]: the packet sizes
  • int channels: the number of channels


  • long int: the maximum sum possible


  • 1 ≤ len(packets) ≤ 5 * 10^5
  • 1 ≤ packets[i] ≤ 10^9

AWS, Server Channels, Packet Transfer, Quality Measurement, Median, Optimization, Algorithm, Function Implementation, Constraints, Data Packets, Channel Capacity.

After the Amazon coding questions, there's a very simple workstyle type of multiple-choice question. With these kinds of questions, there's no need to guess the correct answers, just answer honestly according to what you feel is right, which typically only takes about 5 minutes. And just like that, a pleasant Online Assessment comes to an end. If anyone is aiming for a perfect score, feel free to contact me.


The next part consists of multiple-choice questions for about 15 minutes. Don't stress about this section; just answer honestly according to your true thoughts, there's no need to try to guess the correct answers.


If you're afraid that you can't solve the OA on your own, please scan the code to contact me or telegram

Leave a Reply

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