最近參加了 Booking.com 2025 校招 HackerRank OA,時間 90 分鐘,三道程式設計題。 整體難度不算特別高,但題目設計比較貼近實際業務,考察數據結構、字串和陣列的綜合運用。
整场考试节奏紧凑,时间管理特别重要。幸好我用了 Programhelp 的无痕联机代写,后台有专业工程师同步帮我写代码,节省了不少调试和输入输出的时间,让我能更多时间去检查和优化思路。
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. Thepower 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 possiblepower required to do so.
Example: cells = [20, 30, 40]
- Select cells with values 20 and 30 and merge them to obtain [50, 40]. The power needed for this move is 20 + 30 = 50.
- 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 ≤ 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 toobtain 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. Themanager 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 totalnumber 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.
FAQ
Q: Booking OA 难吗?
A: 難度中等,主要考基礎演算法和編碼實現,細節和邊界條件很重要。
Q: 無痕連線代寫安全嗎?
A: 非常安全,代码输入过程完全本地完成,不留操作痕迹,且代码风格和你平时写的保持一致,不会被检测到。
Q: 有了代寫,還要自己準備嗎?
A: 代寫是輔助工具,最好還是提前準備,代寫能幫你穩住節奏,避免卡殼,關鍵時刻幫你保駕護航。
這次的 OA 還是非常簡單的,有實力的同學完全可以大胆嘗試。 基礎薄弱的同學,可以嘗試找我們協助。 如果害怕自己解決不了 OA,請掃碼聯絡我