# CodeNation Interview Experience (Full-Time SDE, Off-Campus)

Last Updated : 26 Apr, 2020

I got connected to the folks hiring at CodeNation by a 3rd party company called CareerSocially who scouted me through my LinkedIn profile. After a brief discussion about the job role and overview of the interview process, I was ushered in for the process.

Round 1 (Telephonic, Resume Screening):Â This round was approximately 30-35 minutes long and was solely based on my resume. I was initially asked to describe myself and then we had about a 10 minute discussion on my resume where the interviewer jumped around multiple topics to ensure that I knew what I had typed down. He then asked me to pick 3 of my top projects and then asked me justify choosing them. After that, I had to again choose one of them and we had a brief discussion about my approach towards building it and how I could have done better. The interview ended there.

Round 2 (Video Conference, Data Structures and Algorithm):Â This round was approximately an hour long. The questions asked to me were:

• Assume you have been given an undirected graph with no parallel edges. Each vertex represents a city and the edges are roads to travel to another city with different travel times (given). If now the source vertex 0 is infected with Coronavirus, what is the minimum time in which the entire graph will get infected?
Answer:Â I initially suggested a dynamic programming approach in which for eachÂ Node n, I would either use a BFS or DFS to first find out all the predecessors of it (who have a direct link to it) and the minimum time for infecting n will be min(xi + ti)Â (for all such node x and edge time t). We can’t have a node which is not a predecessor and yet will lead to a shorter path (triangle inequality). He seemed satisfied with the logic and asked me to code itÂ without any bugs. Here, I ran into problems with the recurrence relation and since I was running out of time, I asked him whether I could change my implementation. He accepted that and I coded a solution where I ranÂ DjikstraÂ from the source to every node S to find the shortest time and then did a BFS to find out the maximum among them, which would be the solution.
• I was then asked about how I would modify my solution to find the longest time it would take for the virus to spread if I was free to deleteÂ exactly one edge. My answer was that I would delete every edge one by one and run the previous algorithm. He then asked me whether any MSTÂ properties regarding edge deletion could be applied to this problem or not, and we had a discussion about some of then (I also coded Kruskal to demonstrate my knowledge) but my answer was that it won’t be applicable in this context.Â His next question was regarding what optimizations could be made to speed the algorithm up. I suggested searching for articulation points (which would immediately set the answer to Infinity), implementing Djikstra via Fibonacci Heap, etc.
• We finished up with discussing time complexity of some standard algorithms, favourite Data Structure and it’s use (I chose Trie which lead to discussions about it’s efficiency vs HashMap, Linked Tries etc.), Â my strong points during the interview, etc.

Round 3 (Video Conference, System Design): It was for an hour and 40 minutes. I was given two problems to solve, which are:

• We have Rubik’s cube competitions in this world where cubes are shuffled randomly by volunteers before giving it to contestants who solve it simultaneously. Now, the company hosting such competitions uses a computer to generate the shuffle sequence and volunteers are chosen from the crowd. Now, there are two problems with this approach: a), a volunteer might mess a sequence up to purposefully damage a competitor’s chance or b) A volunteer makes an honest mistake. It might not be obvious at first glance that one of the cubes has a slightly altered arrangement. Imagine you are an innovator who is given the task of designing a system which, if presented with the cube can give aÂ Yes/No answer as to whether it is in the correct sequence. We don’t want the system to be time-consuming or expensive.
Answer:Â I initially suggested an ML algorithm based on Computer Vision that was rejected as I didn’t have a clear idea about how such algorithms worked. My next approach was to suggest an IOT-based solution which relied on using sensors on the Rubik cube to detect the turns made and match the sequence – this was rejected as we couldn’t modify industry standard cubes. I suggested a protocol using Google Assistant’s voice matching which only introduced new points of failure. Finally, the suggestion was made that we will use a fixed box with cameras attached to it’s inner faces; the volunteers will drop the cube there and the images of all faces will be taken which will simply be compared pixel by pixel (no ML, and I was able to describe this) which should work as the RGB values in the cube are quite distinct. The box will be compact enough that there are no issues with orientation that could disturb the image. He was okay with this and then asked me to critique it myself, which I did.
• The second problem was to create a class Diagram (UML model) for the following problem: Assuming you have a drone whose job is to plant seeds, how will you write its navigation module such that it can perform it’s job without crashing and going outside a designated bounding box? He didn’t give me any more information and I had to question him to find out about the existing interfaces, the hardware functions available to me (like one’s for getting height, position, etc.) and we then had sort of a pair programming discussion as we both tried to design the cleanest interface possible. He paid special attention to my class/method names, loose coupling, separation of concerns etc.

Round 4 (Video Conference, CEO/HR Round):Â This was the shortest round of only 15-20 minutes. He first explained the general structure of CodeNation and then I was asked general questions about myself, my expectations from CodeNation, how could I help them, discussion about a time I used programming to solve a real life task (I gave examples of a few automation scripts I had written). Following this, he asked me whether I had any questions for him and the interview ended there.

A got a call saying that I was selected for the SDE position the next day and voila, my offer letter was waiting for me! ðŸ™‚