Panda Guru LogoPanda
Guru

Amazon Online Assessment Question 2024 November

Round 1

Questions: Given an array effort of size n, utilizing the EffiBin Kit, users can perform operations on the array. In each operation, the user chooses two positions i and j, such that the effort of the bin at position effort[i] is divisible by the effort of the bin at position effort[j]. When this condition is satisfied, the effort of bin i can be updated to equal the effort of bin j. The objective is to find the minimum total effort after applying some (possibly zero) operations.

Example:

effort = [3, 6, 2, 5, 25] output: 17

Constraints:

Candidate's Approach

The candidate's intuition was to sort the array and then for each element calculate the square root of it. They planned to perform a binary search to find the upper bound of the element with the help of the square root of the element. After finding the upper bound, they would traverse from index 0 to the upper bound index and break out of the loop once they find a divisor. The candidate expressed uncertainty about the efficiency of their solution and welcomed suggestions for improvement.

Interviewer's Feedback

No feedback provided.