0 like 0 dislike
1,603 views
| 1,603 views

0 like 0 dislike

Round 1(Online Assessment): The test was held on CodeSignal. It consisted of 4 questions which had to be completed in 1 hr 20 minutes. The first two checked our implementation skills. The 3rd one checked both implementation and logic. The fourth one was medium to hard level. I solved 3 questions completely and the 4th question partially. I scored 1040/1200. I qualified for the next round.

Round 2(Technical Interview 1): (Duration: 1.5 hrs): This round started with the interviewer analyzing the code that I had written in round 1. He then asked me to solve the 4th question(the one I solved partially before) in the interview. The question was:

Consider that you are given a vector of strings. Output the number of pairs that have the common prefix given that the prefix also is a word in the given strings.
For example:

```[“back”,”backdoor”,”backgammon”,”comeback”,”come”,”door”]
Constraints: 0<n<=10⁵
0<len(string)<100```

Output:

```(back,backdoor),(back,backgammon),(come,comeback)
3```

I solved this question using tries. He seemed satisfied.

Given a start word, a dictionary of words, and a final word, he asked me to calculate the minimum cost required to convert the start word to the final word. In one operation, one character can be changed. But there’s a catch. He wanted me to find out the minimum cost required to convert the start word to the final word.

Input:

```start work
finalWord
dictWords```

Output:

`Cost of the optimal transformation or -1 if not possible`

Example:

```startWord = “dog” //0
finalWord = “hit”
dictWords = {“hog”, “dot”, “hot”, “hit”}
startWord -> finalWord
cost = min(|d -h | + |t -g| + | i — o|)
Solution dog -> hog -> hot-> hit```

This was similar to the Word ladder problem that I had seen earlier. So, I was quickly able to visualize it as a graph. I came up with a solution and he asked me to code it. However, it wasn’t the most optimal one. Lucky for me, I got a call for the next round of interviews.