Amazon SDE-L5

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2024-12-11Added By Anonymous
Source: Link

Round1: Suppose your team is building a new video codec for amazon prime video. One of the step to build this information from a very large database of videos. you are assigned to create a component that reads from a stream of ‘video frames and returns a list of integers which when read was repeated in the previous k video frames.


The way you have to read the video is through a stream object which is provided.

stream = [1, 2, 3, 4, 2, 1, 1, 2, 4] and k = 4

output = [2, 1, 2]

public interface Stream {


//Returns True if stream contains next element or False if end-of-stream.

BooleanhasNext()

1 // Returns next element of Stream. 2 Integer next();

}


Round 2: Can you write me a function to take a string and decrease all costs in the string by 15%? Example string be “ Mary spent 5.25onMP3sthisweek”.Currenciescanbeoftheform5.25, 5.25,andUSD5.25.Oursolutionmustworkforthesecurrencyformatesbutletuskeepinmindthatwewanttoextendthesolutiontoworkforinternationalcurrenciesaswell.Fore.g.EUR,GBPetc.Youaregivenastringcontainingproductinformationanditsprice.Writeafunctionwhichreturnsthesamesentencebutwithareducedprice.Inputexample:’TwoliterCoco−colacosts2.99.”


output:

”Two liter Coco-cola costs $2.54.”


Round 3: Write a small library which allows:

1.registering callbacks for future (ont time) execution, by specifying a function, an optional argument, and time in seconds (relative to now) when the callback should be run.
2.An execute function which should execute (call) all due callbacks.

only system call allowed is the current time.


Round 4: Design a monitoring platform.

Comments