Google | Telephonic | Software Engineer | USA | Feb 2022 [Reject]
Anonymous User
783

Just wanted to share the my telephonic experience. Recruiter reached me, I got interview secheduled after 2 months but was not able to prepare much still, went ahead for interview.

Interview directly jumped over qustion without any intro. There were 2 problems:

Problem 1:
Print numbers of 1s and 2s Strings whose sum is equal to given N.
For eg,

For N = 2
print 2, 11

For N = 3
Print 12, 21, 111

I just did recursive approch to create permutation of 1s & 2s. and checked if given string sum is equal to N. The complexity is 2^N, I was not able to think of 0(N) solution. Interview seems OK with it.

Problem 2:
Print count of total reciprocate edges in Graph. Reciprocate means edges connecting the node to and fro its neightbor
For eg. Graph is given as below
(1,2), (2,3), (5,7), (2,1) , (3,2)

In this the edge 1-> 2 & 2 -> 1 is reciprocate edge. Similarly 2->3 & 3->2.

I was able to think O(N * V) solution where N -> number of nodes and V -> number of edges. But interview insisted O(N) solution. Also asked what data structure will you use to store so you can do it in O(N).
I was not able to solve it.

Comments (4)