Amazon || SDE-1 || 3rd Round

Gave my 3rd round coding round face-to-face.
In this round, i was asked 2 coding questions.

  1. Given stream of infinite numbers like 5,35,64,3,453,.....
    return 2 numbers at any time with maximum occurences.

    We have to use a algorithm which not only keeps track of those 2 numbers but also delete unwanted numbers which have less occurences from top 2. (Can't explain him, move to next ques)

  2. Given string s and list of string, return strings from list that have same pattern of string s.

    s='abcabc'
    arr=['abdabd','abcabc','xyzxyz','asddfa']
    will return [abdabd','abcabc','xyzxyz'] (explained and coded but with some difficulty)

Anyone who have best answers for both of the questions.

Comments (6)