# Stackadapt Interview Experience

interview

This post is to share my interview experience with Stackadapt for a **Senior Software Engineer** position in
Toronto(July 2019). I was initially contacted by a recruiting agency who co-ordinated the interview process.

## Round 0 - Phone Interview with CTO

The first round was a telephonic conversation with the CTO of the company - I was surprised (and a bit nervous) that the CTO is starting off the interview process, but he seemed to be a really nice person and made me feel at home . The following were some of the things discussed:

`Previous work experience, projects and their tech stack`

`What would you have done differently to scale it better?`

`Given a list of words, find the most frequent words(trie + heap)`

- I was also asked this question in my interview
with PaytmLabs. I was just asked to talk
through the approach and explain the time complexity and didn’t write an code.

`Java question related to pass-by-value`

- Very similar to this Stackoverflow discussion on `pass-by-reference`

vs
`pass-by-value`

The recruiter communicated to me a few hours later that I had cleared this round and scheduled an on-site interview the following week.

## Round 1 - Data structures + Coding

The first on-site round was with an Engineering Director and focused on data structures and coding. The interviewer started off with the following question:

`Check if a binary tree is symmetric`

I started with explaining the recursive solution, and the interviewer asked if there are other approaches we could
explore. We then discussed about a solution using the `stack`

data structure, followed by another solution using
the `queue`

data structure. Eventually, the interviewer asked me to code the solution using the queue, which I was
able to wrap up in a few minutes. (The iterative solution using a queue is discussed in GeeksforGeeks, if you’d like to check)

He then extended this question as the following:

`Check if a given n-ary tree is symmetric`

Now this could’ve been really difficult with a recursive solution or the one using stack. However, the `queue`

solution was relatively easier to extend for the n-ary tree. All the nodes at a specific depth/level can be
inserted into a queue, and we can check if the elements in the queue form a palindrome. While comparing two nodes
for the palindrome check, in addition to checking the values in each node, we also have to verify that the
number of children(for the two nodes under comparison) is the same. If these checks hold good for all levels of the n
-ary tree, we can conclude that it’s symmetric.

## Round 2 - Data Structures + Coding

The second round was with an engineer from the team and focused on data structures and coding. I was only asked to solve one question during this round, which is the following:

`Check if a linked list is a palindrome`

I initially suggested a solution using a `stack`

, but the interviewer pushed for a solution with `O(1)`

space
complexity. So, I suggested finding the middle of the linked list, reversing the nodes in the second half of the
linked list and finally checking if the nodes in the first and second half are identical.

I was then asked to code it on paper and write some test cases for the same.

(Both approaches mentioned above are discussed in detail in GeeksforGeeks, if you’re interested to check it out.)

## Round 3 - Data structures + Coding

`Why do you need indexes in DB?`

`What data structures do indexes use? How does a read/write work with indexes?`

`What if itโs a composite index?`

He then switched to a coding problem:

We discussed a few different approaches using `arrays`

, `linked lists`

and the time/space complexity for each. I was
asked to code the solution on
paper, which he then reviewed. I realized after the interview that the question was more open-ended/complex than I
thought and the answer I gave during the interview was far from optimal. I later went through a bunch of
solutions discussed on stackoverflow. I also stumbled upon a totally different approach a few months later ๐

`Find the min number of moves to finish the given board game`

The board he explained seemed to be a simpler variation of the Draughts game, with just a couple of rules. I talked him through the solution I had in mind, and he was keen on understanding it’s space/time complexity - He kept pushing me to optimize it further, but didn’t give any hints or nudge me in the right direction. I am not sure how much more I could’ve done, but we had to wrap up since we were out of time.

## Final Thoughts

I had to wait for a couple of weeks to know the decision, which turned out to be positive. The recruiting agency I was working with, communicated a verbal offer but I had made my decision about joining a different company at this point - So, I ended up not declining the offer. However, I really liked the questions asked during the interview and it was a great learning experience for me.