面试形式：第一轮： 线上笔试，coding。 主要考代码能力。1小时3题。

**q1. Chess Tournament**

The city of Hackerland organized a chess tournament for its citizens.

There are *n* participants numbered 1 to *n* where the *i[th]* participant has potential denoted by *potential*[*i*]. The potential of each player is distinct. Initially, all players stand in a queue in order from the 1st to the *i[th]* player. In each game, the first 2 participants of the queue compete and the participant with a higher potential wins the game. After each game, the winner remains at the beginning of the queue and plays with the next person from the queue and the losing player goes to the end of the queue. The game continues until a player wins *k* consecutive games.

Given the potential of the participants and the deciding factor *k*, find the potential of the winning player.

**Example**

Consider 4*n*=4 participants have =[3,2,1,4]*p**o**t**e**n**t**ia**l*=[3,2,1,4], and 2*k*=2.

- Initial position of participants: [1, 2, 3, 4].
- Participants 1 and 2 compete. Their potentials are 3 and 2. Player 1 wins due to the higher potential. Player 1 stays at the front of the queue and player 2 moves to the back. Now their positions are [1, 3, 4, 2].
- Participants 1 and 3 compete. Their potentials are 3 and 1. Player 1 wins a second consecutive game. Since �=2
*k*=2, player 1 has won enough consecutive games.

Return player 1's *p**o**t**e**n**t**ia**l*, 3.

**Function Description**

Complete the function `getPotentialOfWinner`

in the editor below.

`getPotentialOfWinner`

has the following parameters:

`int potential[n]`

: the potentials of participants`long int k`

: the number of consecutive matches the winning participant must win

**Returns**

`int`

: the potential of the winning player

**Constraints**

- 2≤1052≤
*n*≤105 - ≤1≤
*p**o**t**e**n**t**ia**l*[*i*]≤*n* - 2≤10142≤
*k*≤1014

**Sample Case 0**

Sample Input For Custom Testing:

cssCopy code

`STDIN FUNCTION ----- -------- 5 potential[] size n = 5 1 potential = [1, 3, 2, 4, 5] 3 2 4 5 2 k = 2`

Sample Output:

`3`

Explanation:

- Initial position of participants: [1, 2, 3, 4, 5].
`potential[1]`

= 1,`potential[2]`

= 3, player 2 wins. The positions of participants after match 1: [2, 3, 4, 5, 1].`potential[2]`

= 3,`potential[3]`

= 1, player 2 wins. Since 2*k*=2, player 2 is the winner.

**Sample Case 1**

Sample Input For Custom Testing:

`STDIN FUNCTION ----- -------- `

`4 potential[] size n = 4 3 potential = [3, 2, 1, 4] 2 1 4 3 k = 3`

Sample Output:

Copy code

`4`

Explanation:

Potentials

scssCopy code

`Consecutive Wins Positions 1st in line 2nd in line Winner --------------------------- ----------- ----------- ------ [1, 2, 3, 4] 3 2 1 [1, 3, 4, 2] 3 1 1 [1, 4, 2, 3] 3 4 4 [4, 2, 3, 1] 4 2 4 [4, 3, 1, 2] 4 1 4`

**q2. Reduce the Array**

Given an integer array, reduce the array to a single element.

In each operation, pick two indices *i* and *j* (where *i* !=*j*), and:

- append the value of
*a*[*i*]+*a*[*j*] to the array - delete
*a*[*i*] and*a*[*j*] from the array

The cost of each operation is *a*[*i*]+*a*[*j*]. Find the minimum possible cost to reduce the array.

**Example**

Consider array [25,10,20].

- Pick 10 and 20, cost = 10+20 = 30, array' = [25,30]
- Pick 25 and 30, cost = 25+30 = 55, array'' = [55]

The cost is 30+55 = 85. This is the minimum possible cost.

**Function Description**

Complete the function `minimizeCost`

in the editor.

`minimizeCost`

has the following parameter:

`int arr[n]`

: an array of integers

**Returns**

`int`

: the minimum cost of reducing the array

**Constraints**

- 2≤1052≤
*n*≤105 - 1≤1001≤
*a**rr*[*i*]≤100

总体还是非常简单的，经过我们csoahelp的辅助，可以轻松ac。

第2-4轮：和QRT的trader&researcher 一对一轮流面试。面试时间可以自己选 （对方给你一个calendar，自己book）。面试内容包括简历经历，数理统计，以及职业规划。

联系我来获取完整的题目信息和解题思路，我们可以协助您通过任何OA VO