Fourkites Interview Experience | Summer Internship
This was a campus recruitment so the level and difficulty might vary according to your college
Round 1: Coding round on Hackerearth
Some 20 MCQ Questions on aptitude and C/Java code output and 2 Coding questions. I was able to pass all testcases for the first question whereas only 2/3 testcases for the second question. I was 1 of the 3 people selected from this round. I don’t remember the question as of now.
Round 2: Technical Round 1
We started by discussing my projects on resume and he asked me to elaborate on one of mine Node.js project which was a blogging site supported with Node.js + mongoose at the backend. I was asked why I used mongoose and not some relational database which was because I was learning at that time and the instructor was using mongoose so I went with the same. Then he asked me a question based on SQL
Question: Given a table, extract its odd columns.
I tried but since I didn’t the answer I accepted that I don’t know the answer
Then we continued with a programming question
Question 1: Given two linked lists how can you merge them into one sorted linked list.
I first merged the two linked list by joining the last node of the first linked list to the
first node of the second linked list and sorting them using bubble sort
He asked me to improve the complexity of the solution.
I asked him if there is any limit on memory, he said no. So I again joined them and
used counting sort on the merged list
Now he said assume there is a limit on memory.
I told him I know merge sort will be helpful to first sort them and then merge but
I don’t really know how merge sort is applied on linked lists, I know only for array and lists.
He asked the time complexity of merge sort and to assume its a sorted list now merge them.
I used two pointers pointing to the start of the lists and merging their elements one by one by
moving the pointer one by one on the lower node until all the nodes aren’t added to the new list.
Here is the code
I was asked the time complexity of the program, I replied
(Where n and m are the lengths of the lists). He corrected and told me its
Round 3: Technical Round 2
It started with a basic introduction and a question on data-structure.
Question: You have
logs and you can join two of them at a time with a cost
equal to the sum of their lengths. You have to join all the logs to a single log with minimum cost
I took some time to think about the solution, I thought if I keep joining the two smallest ones
it should give the minimum cost so I asked for an example to better understand the problem.
Example: 5 logs of size 2 3 4 5 7. Answer: 47 Solution: 2+3 = 5, logs = 4, 5, 5, 7 cost = 5 4+5 = 8, logs = 5, 7, 9 cost = 5+9 5+7 = 9, logs = 9, 12 cost = 5+9+12 9+12 = 21, logs = 21 cost = 5+9+12+21 = 47 I could have sorted the list but after each join, I will have to insert a new log into the list that can take
for each log hence making the solution
So I used minheap to calculate the minimum logs every time. The top node is already the minimum
and after removing it the 2ed minimum comes to the root.
Insertion time in a heap is
which is a lot better than
Here is the code:
I was asked the total time complexity of this operation which is
Round 4: Technical Round 3
The interviewee started off by asking me about my projects then asked why
Interviewee: Why do you want to do an internship in SDE
Me: I have loved problem-solving since I started competitive programming and I love doing development hence I find Software Development the right position for me.
Interviewee: What is your favorite Data Structure and
Me: Tree and then I brought up my project about generating test completion using Trie Data Structure and we discussed how we can handle large data when a lot of data with Trie. I suggested trimming the tree as most of the nodes at the leaf side will be NULL pointers which will help to save a lot on space in memory.
This was a pretty short interview that lasted for 30-40 minutes.
In the end, I was one of the 2 people selected as an SDE intern at Fourkites