Visa Interview(TrialPay) Skype Call (2 Rounds)

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2019-09-10Added By Anonymous
Source: Link

Visa Interview(TrialPay) Skype Call (2 Rounds)

2 rounds- 1Hr each


1st Round- Manager and Engineer, Coding.

Given a root directory, traverse the directory through its sub directories, to each of the files. Output the list of sets of files having the same content.

Input: '/home'

Output:'/home/users/abc.txt' '/home/test/ijk.csv'

'/home/node/app.js' '/home/node/project1/index.js'

'/home/java/main.java' '/home/java/project2/main.java'


Round 2: Senior Engineer, Coding

Given a Huge dictionary of words, and an input stream, return a set of words, which exist in the input stream.

Input stream: "skfjhhelloasjfh sadiokdjnfn..........."

(Input Stream could be random with or without spaces)

Dictionary: foo

smile

sad

bad

hello .... and so on


Output: hello, sad

O(n2) was acceptable, but was asked to give a verbal solution of O(n) (KMP or Z algorithm).

Comments