Online test was heavily proctored and was conducted on Hackerank platform. Sreensharing and webcam permission were asked. There were two coding questions both were Medium to Hard difficulty.
Question 1: A server network is represented as a tree of g_nodes servers indexed from 1 to g_nodes and g_nodes - 1 edges where the ith edges connect the servers g_from[i] and g_to[i]. The transfer time between any two connected servers is 1 unit.
Given the graph g, find the maximum time taken to transfer the data between any two servers in the system.
Example
Suppose g_nodes = 3, g_from = [1, 2], g_to = [2, 3]
The maximum time is required to transfer data from 1 to 3 that takes 2 units of time. Hence, the answer is 2.
Question 2: There are n processes to be executed, and the iᵗʰ process has a size of processSize[i], where 1 ≤ i ≤ n. Also, there are m processors of different size capacity. The capacity of the iᵗʰ processor is capacity[i] ( 1 ≤ i ≤ m ). A processor can process a task of size less than or equal to its capacity in 1 second, but it cannot execute processes whose size is greater than its capacity.
A processor can execute multiple processes one after the other, but needs to pause for 1 second after completing its current one. Multiple processors can work on different processes simultaneously.
Find the minimum time to execute all the processes or return -1 if there is no way to execute all the processes.
Example
It is given that n = 3, processSize = [2, 5, 3], m = 3 and capacity = [6, 2, 4]
The optimal way to assign processes is to give:
All of them complete their processes in 1 second. Therefore, the minimum time required is 1 second.