亚麻实习店面挂经

面的是 SDE Intern 2020

题目
First Unique Number in Data Stream

A: I used an ordered set and map to provide the answer. The set will store the numbers which are added to the stream for the first time and map will store the count.When a number comes the corresponding count of it in the map is updated. When a number comes for the first time, I add it to the ordered set.

When a number comes for the second time I remove it from the ordered set.

The first elem from the set will be the number.I told this solution to the interviewer to which he agreed and asked the time and space complexity.I answered both of them correctly. Then he started asking me what if you didn’t have the ordered set. And that was like 5 minutes remaining.

I couldn’t frame this within the time and was rejected .

He expected me to answer a DLL instead of an ordered set, but what about the solution I provided?

Was very much dissatisfied with the experience.

P.S: I gave a decent enough OA3 and had all my test cases passed for OA2.

1 Like

也报一个

Given an absolute file path and a relative file path as inputs, write a function to determine the working directory after performing a cd command with the relative path as its argument.

e.g.

inputs:
absolute path: “/bin/etc/abc”
relative path: “/…/xyz/tuv/…/”

output:
“/bin/etc/xyz”