Welcome to SE Graduate ProgramHackerRank Test 2024 Booking.com

booking今年的OA由2道算法题2道选择题组成,限时75分钟。

This year’s booking OA consists of 2 algorithm questions and 2 multiple choice questions, with a time limit of 75 minutes.


The text extracted from the images provided, formatted and organized for clarity, is as follows:


QUESTION 1

In a game, there is an array of cells, each with an integer value. In one move, merge any two cells to obtain a new cell that contains the sum of the two cells. The power needed in each move is the sum of the values of the two merged cells. The goal is to merge the cells until only one cell remains. Find the minimum possible power required to do so.

Example: cells = [20, 30, 40]

  1. Select cells with values 20 and 30 and merge them to obtain [50, 40]. The power needed for this move is 20+30=50
  2. Select cells with values 50 and 40 and merge them to obtain [90]. The power needed for this move is 50+40 = 90

The total power required is 50+90 = 140. This is the minimum possible power.

Function Description

Complete the function `

minPower in the editor.

minPower has the following parameter:

  • int cells[n]: the values of each cell

Returns

  • int: the minimum power required to finish the game

Constraints

  • 2≤1052≤n≤105

QUESTION 2

Given array = [6, 15, 2, 4, 3, 8, 19]. After applying heapify operation on the array, the array will look like:

Pick ONE option

  • [19, 15, 6, 4, 3, 8, 2]
  • [19, 6, 15, 4, 3, 8, 2]
  • [19, 15, 4, 6, 3, 8, 2]
  • [19, 6, 15, 8, 4, 3, 2]

Q3是所有题目中最难的一道,这里仅文字不好把题干发全,可以联系我来获取题目的截图

Q3 is the most difficult of all the questions. It’s not feasible to convey the entire problem statement with text alone. Please contact me to obtain a screenshot of the question.

QUESTION 3

A warehouse manager must optimize the allocation of resources in their warehouse. There are two rows of storage units, having lengths n and m respectively. Each unit has a certain amount of resources, but some units (possibly, none) are currently empty. The empty units are denoted by 0. The manager wants to allocate new resources in these empty units such that the total number of resources in both rows is equal. Return the minimum equal total number of resources in each row, or -1 if such allocation is not possible.

Question 4

It is not convenient to post the picture of Q4. If you need it, you can scan the QR code and contact me.

这次的OA还是非常简单的,有实力的同学完全可以大胆尝试。基础薄弱的同学,可以尝试找我们协助。如果害怕自己解决不了OA,请扫码联系我

Leave a Reply

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