Welcome to IBM US – Standard – Back-End – OA 代写 – 面试代面 – 面试辅助 – OA writing 

Instructions

How Test Timing Works: Please make sure you can complete this test in one sitting, as the timer cannot be stopped once you begin. Clicking "Agree & Start" starts your running timer, even if you are not actively in the test. Importantly, the timer does not pause if you log out or get disconnected from the assessment.

Test duration: 45 mins
No. of questions: 2 questions

A Few Things to Consider:

  • This is a programming test. Please be prepared to encounter programming/coding challenges during the assessment.
  • You must submit a response to all questions to be considered completed.
  • For an optimal experience, ensure you have a stable internet connection, and please complete this test in Mozilla Firefox 101+ or higher or Google Chrome 102+ or higher.

Question 1

HackerRank is organizing a hackathon for all its employees.

A hackathon is a team event, and there are n teams taking part. The number of employees in the i-th team is denoted by teamSize[i]. In order to maintain uniformity, the team size of at most k teams can be reduced. Find the maximum number of teams of equal size that can be formed if team size is reduced optimally.

Example

There are n = 5 teams, and team sizes are teamSize = [1, 2, 2, 3, 4], and the maximum number of teams whose size can be reduced is k = 2.

The team size of the last 2 teams can be reduced to 2, thus teamSize = [1, 2, 2, 2, 2]. The maximum number of teams with equal size is 4.

Function Description

Complete the function equalizeTeamSize in the editor below.

equalizeTeamSize has the following parameters:

  • int teamSize[n]: the number of employees in each team
  • int k: the maximum number of teams whose size can be reduced

Returns

  • int: the maximum number of equal-size teams possible

Constraints

  • 1 ≤ n ≤ 200,000
  • 1 ≤ teamSize[i] ≤ 1,000,000,000
  • 0 ≤ k ≤ 1,000,000,000

Sample Case 0

Sample Input For Custom Testing


STDIN FUNCTION
4 teamSize[] size n = 4
1 teamSize[] = [1, 2, 3, 4]
7
3
8
1 k = 1

Sample Output

2

Explanation

The number of employees in the second team can be reduced to 1. No more teams can be chosen since k = 1.

Question 2

A shipping company's control panel needs a query that returns a list of all customer packages that are in the process of being delivered.

The result should have the following columns:

  • email: customer email address
  • total_packages: total number of all packages for a specific customer
  • total_weight: total weight of all packages for a specific customer

The result should be sorted in descending order by total_weight.

Note:

  • The total weight of all packages is equal to the sum of the weights of all packages.
  • Only packages with the status 'created', 'shipped', or 'on hold' should be included in the result.

Schema:

customers
idINTPRIMARY KEY
emailVARCHAR(255)Customer email address
packages
idINTPRIMARY KEY
statusVARCHAR(20)Status of the package
weightFLOATWeight of the package
customers_packages
customer_idINT
package_idINT

customers :

idemail
1nhalifax0@auda.org.au
2nbrashier1@reference.com
3aflowerdew2@columbia.edu

packages :

idstatusweight
1delivered93.37
2created86.16
3delivered66.24
4delivered78.63
5on hold53.33
6cancelled53.34
7created13.25
8delivered17.54
9shipped42.80
10on hold72.64
11cancelled93.14
12delivered64.94
13delivered58.34
14shipped6.92
15cancelled58.50
16delivered99.20
17delivered11.26
18created94.78
19shipped12.28
20created5.16

customers_packages :

customer_idpackage_id
14
16
113
218
27
28
29
215
311
320
319
317
316
314
312
31
310
35
33
32

Expected Output Example:

emailtotal_packagestotal_weight
aflowerdew2@columbia.edu6236.49
nbrashier1@reference.com3150.83

我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.

Leave a Reply

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