BlackRock | Associate | Java Backend Developer | Mumbai | Interview Experience
Summary
I attended a 45‑minute interview for a Java Backend Developer role at BlackRock in Mumbai, which included a coding problem on HackerRank, a string‑frequency task, and several Java and system‑design questions.
Full Experience
Interview 1: 45mins
- 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: 15−7=8. New ability: ⌊7/2⌋=3.
Second 2: Use processor with ability 4. Processes remaining: 8−4=4. New ability: ⌊4/2⌋=2.
Second 3: Use processor with ability 3. Processes remaining: 4−3=1. New ability: ⌊3/2⌋=1.
Second 4: Use processor with ability 1. Processes remaining: 1−1=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;
}
- Calculate frequency of the given string (solved on notepad) - need to solve using streams
- Technical Questions
- HashMap internal implementation,
hashCode()working, What happens when we ovveridehashCode()? - Java Multithreading -
synchronizedblock,ExecutorService - Microservices - Circuit Breaker
- Difference between
@Componentand@Configuration - Bean Lifecycle
- Kafka working
- HashMap internal implementation,
Interview Questions (1)
Process Scheduling
A multiprocessor system contains several processors, where ability[i] represents the number of processes the i‑th 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) and its ability is reduced to ⌊ability/2⌋.
Goal 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 → remaining processes 8, new ability 3.
- Second 2: Use processor with ability 4 → remaining processes 4, new ability 2.
- Second 3: Use processor with ability 3 → remaining processes 1, new ability 1.
- Second 4: Use processor with ability 1 → remaining processes 0.
Constraints
- 1 ≤ size of ability ≤ 10⁵
- 1 ≤ ability[i] ≤ 10⁶
- 1 ≤ processes ≤ 10¹²
- It is guaranteed that the processes can be scheduled using the given system.