Uber | Onsite | 2021

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2022-03-17Added By Anonymous
Source: Link

Company: Uber

Interview Stage: Onsite

Year: 2021


Original Post Content:


Find the lowest, highest, median price of a stock, you will be alerted when the price of a stock is updated, so the stock will be coming like a stream. Finding a median I see a lot of solutions online, but I don't see any solution for finding the lowest and highest value until now.


Example Input:


Stock:

19878800 - > $2,541.07

19878801 - > $2,000.01

19878802 - > $3,600.08

19878803 - > $500.04

19878804 - > $1000

Write the methods for lowest(), highest() stock until now. The stream will continue. Whenever we call this function it should return the lowest value of the stock till now, and if we call the highest value function, it should return the highest value of stock till now. Any python solutions please

Comments