Third Interview
Question asked was: You are given a list of jobs, and task scheduling should be First Come First Serve (FCFS).
A job will contain two things:
You have to print all the jobs in the manner they will get executed.
Example:
| Job | Start Time | Execution Time |
|---|---|---|
| 1 | 0 | 10 |
| 2 | 2 | 6 |
| 3 | 3 | 1 |
You have to print: Job 1: start time - 0, end time - 10 Job 2: start time - 10, end time - 16 Job 3: start time - 16, end time - 17
This was simple: sort the list of jobs and traverse the collection of jobs.
Follow-up Question Asked:
Now, in the same question, there is a priority involved. You will first consider the start time. If there are multiple jobs available, the one with the lowest priority will be selected.
Example:
| Job | Start Time | Execution Time | Priority |
|---|---|---|---|
| 1 | 0 | 10 | 4 |
| 2 | 2 | 6 | 3 |
| 3 | 3 | 1 | 2 |
| 4 | 20 | 2 | 1 |
Here, after the execution of Job 1, Jobs 2 and 3 are available, but Job 3 will get selected.
In this approach, I used a priority queue and added jobs to the priority queue only when their start time was less than or equal to the completion time of the previous one.
Googliness Round:
Q&A Round:
I asked some questions here.
A question was asked:
You are given a gold chain made up of hooks of gold.
Given the weight of each hook in sequential order, you have to sell one hook and check whether the remaining chain can be divided into two parts.
The following metrics were computed from 450 interview experiences for the Google Software Engineer role in India.
Google's interview process for their Software Engineer roles in India is extremely selective, failing the vast majority of engineers.
Candidates reported having very good feelings for Google's Software Engineer interview process in India.