Answer: YOKOGAWA Hiring Challenge | Online Assessment Question | Off-Campus (2025)
Answer · Posted Jun 2026
Approach Always increment the smallest element to maximize the final product. Store all elements in a Min Heap. Repeat k times: Remove the smallest element. Increment it by one. Insert it back. Multiply all elements modulo 10^9 + 7. Strategy Use a Priority Queue (Min Heap). Perform k increment operations on the smallest element. Compute the final product modulo 10^9 + 7. Java Code import java.util.PriorityQueue; class Solution { public int maximumProduct(int[] nums, int k) { int MOD = 1_000_000_007; ...
The full answer & interview discussion are available to premium members.
Log in Create a free account