Skip to content
loading...
Cover image for Can you answer this google interview question?

Can you answer this google interview question?

comscience profile image kapeel kokane twitter logo github logo ・1 min read  

Do you think you can? (3 Part Series)

1) Can you answer this google interview question? 2) Can you solve the fastest horse 🐴 algorithm problem? 3) Can you crack this google interview question? The maximum subsequence problem.

The Problem Statement 👨🏾‍💻

There is a continuous stream of numbers that you are supplied with, wherein you get to know the new number added to that stream one at a time. At any given moment, you will be asked the question: what is the median in the current stream of numbers that you have seen so far? and you have to solve the problem with the most efficient solution.

Key Points to consider 🔑

  • What data structure would you use to store the stream?
  • What would be the time complexity of adding a number to the stream data structure that you are using?
  • What would be the time complexity of fetching the real-time median at any given moment?

After giving it a try yourself, watch this video where I cover one of the most optimum solutions for the same problem:

Hope that helped, cheers!✌🏾

twitter logo DISCUSS
Discussion
markdown guide
Classic DEV Post from Jul 26 '19

🎩 JavaScript Enhanced Scss mixins! 🎩 concepts explained

In the next post we are going to explore CSS @apply to supercharge what we talk about here....

kapeel kokane profile image
Coder by day, Content creator by night, Learner at heart!