Problem · Greedy

Find Minimum Time to Defuse All Bombs (For off-campus 2025 batch hiring :)

Learn this problem
MediumUber logoUberNEW GRADOA
See Uber hiring insights

Problem statement

Another question about defusing bombs - uber-defuse-the-bombs

There are N bombs in a row, each bomb 💣, say i (0 <= i < N) has a detonation time of xi and time to defuse it is yi. Find the minimum time to defuse all the bombs if possible, otherwise -1.

The first line of input is the number of bombs N. The second line consists of N space separated values denoting the time to defuse the bombs. The third line consists of N space separated values denoting the time for detonation of bombs.

Function

findMinimumTimeToDefuseAllBombs(defuseTime: int[], detonationTime: int[]) → int

Examples

Example 1

defuseTime = [2, 1, 3, 1]detonationTime = [4, 9, 8, 2]return = 7
🐻‍❄️

More Uber problems

drafts saved locally
public int findMinimumTimeToDefuseAllBombs(int[] defuseTime, int[] detonationTime) {
  // write your code here
}
defuseTime[2, 1, 3, 1]
detonationTime[4, 9, 8, 2]
expected7
checking account