BlackRock | Associate | Java Backend Developer | Mumbai | Interview Experience
Anonymous User
550
Mar 25, 2026
Mar 25, 2026

Interview 1: 45mins

  1. Coding Question asked on HackerRank CodePair Platform
Process Scheduling
A multiprocessor system contains several processors, where ability[i] represents the number of processes the ith processor can schedule in one second.

Problem Description
In each second, you can choose any one processor and use it to schedule up to its current ability. 
Once a processor is used:
It schedules the processes (up to its maximum current capacity).
Its ability is reduced to ⌊ability/2.
The goal is to determine the minimum time (in seconds) required to schedule all given processes.

Example
Input:
ability = [3, 1, 7, 2, 4]
processes = 15

Output: 4
Explanation:
Second 1: Use processor with ability 7. Processes remaining: 157=8. New ability:7/2=3.
Second 2: Use processor with ability 4. Processes remaining: 84=4. New ability:4/2=2.
Second 3: Use processor with ability 3. Processes remaining: 43=1. New ability:3/2=1.
Second 4: Use processor with ability 1. Processes remaining: 11=0.

Total time taken: 4 seconds.

Constraints
1≤ size of ability ≤10^5
1≤ ability[i]10^6
1≤ processes ≤10^12
 
It is guaranteed that the processes can be scheduled using the given system.

Solution:

public static int minimumTime(List<Integer> ability, long processes) {
    
        int ans = 0;
        PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());
        
        for(int a: ability) {
            pq.add(a);
        }

        long rem = processes;
        
        while(!pq.isEmpty()) {
            Integer pr = pq.poll();
            rem = rem - pr;
            pr = pr/2;
            
            if(pr != 0)
                pq.offer(pr);
            ans++;
            if(rem<= 0) {
                break;
            }
        }
        
        return ans;
    }
}
  1. Calculate frequency of the given string (solved on notepad) - need to solve using streams
  2. Technical Questions
    • HashMap internal implementation, hashCode() working, What happens when we ovveride hashCode()?
    • Java Multithreading - synchronized block, ExecutorService
    • Microservices - Circuit Breaker
    • Difference between @Component and @Configuration
    • Bean Lifecycle
    • Kafka working
Comments (4)