Rubrik | Phone Interview | Dynamic Programming | Similar to Edit Distance Hard

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2022-01-26Added By Anonymous
Source: Link

Yoe: 3

L3/L4 position in CA

Rubrik recruiter reached out to me on LinkedIn and I decided to undergo the phone interview.

First and last technical question that was given to me:


Given 2 Files in an array list:

File1-

A

B

D

C

E


File 2-

B

R

C

F

T

E


Output the file changes that occured in File1 and File2. For no changes occured, just print the letter, If a letter was added from File1 in File2, add a '+ Letter'. If a letter was removed from File1 in File2, add a '- Letter'. You can assume for now they are all uppercase.


file1 = ['A', 'B', 'D', 'C', 'E']

file2 = ['B', 'R', 'C', 'F', 'T', 'E']


Output: ['- A','B','+R','-D','C','-F','+T','E']


I thought this was an interesting problem and maybe this is how GitHub handles all the different types of added and deleted characters in 2 files.

If anyone knows the leet code question for this, feel free to post below.

Comments