# Pharmeasy Interview Experience | Software Engineer | On Campus

• Difficulty Level : Expert
• Last Updated : 05 Dec, 2018

Round 1 – Resume Shortlisting

A total of 166 resumes were sent to the company out of which 29 were shortlisted for next round.

Round 2 – Written Technical Test

Duration of the test was 30 minutes. The test had 5 questions, 3 objective and 2 coding questions.

Question 1 – A code snippet in python was given and we had to find the mistakes in the code.

Question 2 – There are n bulbs that are initially off. You first turn on all the bulbs. Then, you

turn off every second bulb. On the third round, you toggle every third bulb (turning on if it’s

off or turning off if it’s on). For the i-th round, you toggle every I bulb. For the n-th round,

you only toggle the last bulb. Find how many bulbs are on after n rounds.

Ans – If the position number of the bulb is a perfect square then it will be on.

Question 3 – A total of n players participated in a single tennis knockout tournament. What is the total number of matches played in the tournament? Assuming that there is a single winner.

(Knockout means if a player loses, he is out of the tournament). No match ends in a tie.

Ans – n-1 matches

Question 4 – Write a program to print all permutations of a given string. The order does not matter. You need to write the complete code and not just the pseudo code.

There was nothing given in the question about the duplicates in the string, therefore, I wrote the code which would run for both type of strings, with or without duplicates.

Question 5 – Say you have an array for which the i-th element is the price of a given stock on day i.

Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e. buy one and sell one share of the stock multiple times).

Note – You may not engage in multiple transactions at the same time (i.e., you must sell the stock before you buy again).

You might be thinking that it is just impossible to complete this test in just 30 minutes but if you have a very good practice then it’s not that tough. As you can see, the coding questions are not new and questions 2 and 3 are also popular puzzles. Practice is the key.

After this round, 13 students were shortlisted for further interview rounds. All the interviews were over Skype.

Round 3 – Technical Interview 1 (Duration: 90 minutes)

This was the first interview round and it was with the CTO of PharmEasy. The interview started with the discussion on my resume. He asked me about my projects. One of the projects was my Google Summer of Code project so he asked me to explain that project in detail.

Then he started with the coding questions. He asked 2 questions:

Question 1 –He asked me the algorithm to implement autocomplete feature for a search bar. For example – If I have entered “bar” into the search bar then my algorithm should suggest me all the valid words starting with “bar” and then if I enter ‘e’ after that then all the valid words starting with “bare”.

While explaining me the question, he used the word “trie”. I knew about the data structure Trie and I had never worked with it so I told him that I don’t know anything about Trie. So, he asked me to forget about Trie and just suggest an algorithm to solve the problem.

After having a discussion of 15-20 minutes with him, I gave him the solution after which he told me that that is actually the implementation of Trie and then he was impressed that I had come up with Trie based solution without even knowing anything about Trie.

Question 2 – Now he further extended the problem that what if someone enters the incorrect spelling of a word. Like PharmEasy is an e-pharmacy based company and while ordering medicines from its app, let’s say someone entered the incorrect spelling of a medicine into the search bar. My algorithm should suggest the correct spelling of the medicine. This was very much similar to “Did you mean” feature of Google search when we enter any incorrect spelling.

The interviewer was very friendly, and he helped me a lot while moving towards the solution. I was really difficult for me to come up with a correct algorithm for the problem. After having a lot of discussions, I came up with a solution which was not completely correct. I needed to optimize it more. We again had a discussion of around 10 minutes, but I was unable to tell him the best solution. After that, he told me the solution and that it is solved with the help of Suffix Tree.

I had never even heard the name of suffix tree before that day. I was just astonished that how can the first round of any company be that much difficult.

After these 2 questions, he asked me about hashing. Some basic concepts about hashing, methods to deal with collisions, how do we implement hashing and related stuff.

At last, he asked me if I had some questions about the company. My interview didn’t go as well as I expected, and I had to create an impression on him, therefore, I asked him a lot about the company. For the next half an hour, we were talking about PharmEasy and what it does and similar things to let him know how much passionate I am about this job.

Round 4 – Technical Interview 2 (Duration: 30 minutes)

This round started with the interviewer saying, “I am very much impressed by your resume.”

He asked me 2 puzzles and 2 coding questions and then some discussion on my resume.

Puzzle 1 – There are 25 horses among which you need to find out the fastest 3 horses. You can conduct race among at most 5 to find out their relative speed. At no point, you can find out the actual speed of the horse in a race. Find out how many races are required to get the top 3 horses.

Puzzle 2 – How do we measure forty-five minutes using two identical wires, each of which takes an hour to burn. We have matchsticks with us. The wires burn non-uniformly. So, for example, the two halves of a wire might burn in 10 minutes and 50 minutes respectively

Coding question 1 – Given a sorted array arr[] and a value X, find the k closest elements to X in arr[].

Coding question 2 – Quicksort on a singly linked list

I gave him answers to all of the above questions and then, he asked me to explain him my GSoC project and he also liked the work I did in that project.

My GSoC project was on designing and implementing cross-platform APIs where the target platforms were Android, iOS, Mac OS X, Windows and Linux. My organization was Python Software Foundation (Kivy) and the project was named, Plyer.

After this round, 5 students got shortlisted and the next and final interview round.

Round 5- Technical Interview 3 (Duration: 30 minutes)

This round had only one problem, in which the interviewer asked me to implement a URL shortener like Bitly or TinyURL.

I started with giving him a hashing-based solution but then I explained him the problems which will be faced due to collisions and then we had a discussion on how we can come up with a better solution. Since the interview was telephonic, I had to keep on speaking my mind so that he can understand my thought process. He gave me several hints too and till the time got over, I gave him the solution which was 90% complete and he told me that I have come to a decent approach and if I will work on it for next few minutes I will solve it completely. Overall, he was satisfied with my answer.