Open In App
Related Articles

Flipkart Interview Experience | SDE-1 (Experienced)

Improve Article
Save Article
Like Article

Round 1: Machine Coding Round (1.5 hrs)

I was  given  the following problem statement and asked to  implement it with any choice of programming language.  They expected the code to be production-level, modular and bug free. After this, there was an evaluation round for the code. They tested the code with all corner cases and asked me to modify the code for new requirements which I was able to do easily.


A job scheduler to schedule M jobs on N threads on a single machine. The input contains the following data:

  1. Job Name
  2. Duration: time taken for job completion
  3. Priority: priority of the job. P0>P1>P2
  4. Deadline: Expiry time after which job should not be run (The clock starts from 0 and deadline is the actual clock time)
  5. UserType: Type of user who has initiated the job, Precedence of users Root>Admin>User

There are various scheduling algorithms-

Shortest Job First – SJF

Shortes job first (SJF), is a scheduling policy that selects the waiting process with the smallest execution time to execute next. In case of tie choose the job according to the following order-

  1. Priority(higher priority job gets scheduled first)

First Come First Serve -FCFS

Jobs are executed on first come, first serve basis. Take the input as the order of jobs need to be scheduled.

Fixed Priority Scheduling -FPS

Each process is assigned a priority. Process with highest priority is to be executed first and so on. In case of tie choose the job according to the following order-

  1. User Type
  2. Longest Job First

Earliest Deadline First – EDF

Next job will be searched on the basis of job which is closest to its deadline. In case of tie, choose the job according to the following order-

  1. Priority(higher priority job gets scheduled first)
  2. Duration(lesser duration job gets scheduled first) In case we cannot schedule a job such that it completes before its deadline then it should be ignored.

You would be given a list of jobs (refer example below for format) and number of threads as input. You are expected to print the order of jobs scheduled for each algorithm on each thread as output.


Threads= 2

Job Name Duration Priority Deadline User Type
J1 10 P0 10 Root
J2 20 P0 40 Admin
J3 15 P2 40 Root
J4 30 P1 40 User
J5 10 P2 30 User
Thread 1 - J1, J3, J4
Thread 2 - J5, J2

Thread 1 - J1, J3, J5
Thread 2 - J2, J4

Thread 1 - J1, J4, J5
Thread 2 - J2, J3

Thread 1 - J1, J2
Thread 3 - J5, J4


Round 2: PS-DS Round (1 hr)

This was a problem solving and data structures related round.

Interviewer asked me following questions with working code.

  1. At any point of time, find the average of max k numbers from an incoming stream of infinite numbers. I solved it using min-heap of k size and maintaining a sum variable to find the average. For every insertion to min-heap add the element to sum and for every deletion from min-heap, subtract the element from sum.  To get the average return sum/no. of elements.
  2. Copy the contents of  a given stack to another stack in same order without using extra space.
  3. Rain water trapping problem.

I solved all of the above problems and my interviewer was satisfied.

Round 3: Hiring Manager Round (1 hr)

The HM had  an in-depth discussion on my latest project and technologies that I had used in the project.He asked me a lot of behavioral questions as well.

After a few weeks I got the offer.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 06 Aug, 2018
Like Article
Save Article
Similar Reads