For the best experience, increase the window size or view on a laptop or desktop device
Title | ||
|---|---|---|
Loading... | ||
For the best experience, increase the window size or view on a laptop or desktop device
Title | ||
|---|---|---|
Loading... | ||
The question involved an integer array that represents amounts of money in bank accounts. The task was to ensure that each number exceeded a certain threshold by redistributing the money, and to provide a solution for the transfers. For instance, given the array [3, 5, 11, 28] with a minimum threshold of 10, I devised a solution: transfer 7 from index 3 to index 1, and transfer 5 from index 3 to index 2, resulting in the array [10, 10, 11, 16]. I found the question too easy, so I asked if there were any additional costs associated with transferring money, or if there was a need to minimize the number of transfers. The interviewer replied that there weren’t any such considerations. When asked about optimization, I suggested sorting the array and fulfilling the least sufficient amounts with the most sufficient amounts first. Surprisingly, I advanced to the next round of interview.
The question involved an integer array that represents amounts of money in bank accounts. The task was to ensure that each number exceeded a certain threshold by redistributing the money, and to provide a solution for the transfers. For instance, given the array [3, 5, 11, 28] with a minimum threshold of 10, I devised a solution: transfer 7 from index 3 to index 1, and transfer 5 from index 3 to index 2, resulting in the array [10, 10, 11, 16]. I found the question too easy, so I asked if there were any additional costs associated with transferring money, or if there was a need to minimize the number of transfers. The interviewer replied that there weren’t any such considerations. When asked about optimization, I suggested sorting the array and fulfilling the least sufficient amounts with the most sufficient amounts first. Surprisingly, I advanced to the next round of interview.
Output