Google Interview Report
- -1of 1 vote
AnswersThere is a stream of data <Symbol, timestamp, price>, and possibly also Correction Data <Symbol, timestamp, price> and then addData (symbol, timestamp, price) and correctData , Update minPrice, maxPrice, recentPrice in these two functions.
- ajay.raj January 04, 2018 in United States| Report Duplicate | Flag | PURGE
Google SDE1 - 0of 0 votes
Answersassuming there is a freeway, n cars on the road, each car has a different integer speed, but are in the 1-n range. Now give you an array that represents the speed of each car. The starting order of the vehicle is the order of the array, ask the final formation of several clusters, the size of each cluster is how much? It can be understood that, although the vehicle speed is different, but even behind the car faster than the previous car, because you cannot pass, the last must only travel at the speed of the previous car, which formed a cluster. For example [2,4,1,3], finally [2,4] is a cluster, [1,3] is a cluster.
- ajay.raj January 04, 2018 in United States
Follow up is now suppose you want to add a car, the speed of the car than other large, but not sure the car's starting order, so that the final output of each possible cluster (List of List). Requirements can be adjusted and call the previous function, but can only be called once| Report Duplicate | Flag | PURGE
Google SDE1 - 0of 0 votes
AnswerGive you a bunch of data <key, value, expiredTime>, design a data structure storage.
- ajay.raj January 04, 2018 in United States
About the idea, based on Map solution.
class NewMap {
Map <Integer, Integer> data = new HashMap <> (); // store key-value pairs
Map <Integer, Integer> expired = new HashMap <> (); // store key-expired pairs
}
Then implement the three functions get (), put (), expire ().| Report Duplicate | Flag | PURGE
Google SDE1