But it doesn't have to end here! Sign up for the 7-day coding interview crash course and you'll get a free Interview Cake problem every week.
You're in!
You decide to test if your oddly-mathematical heating company is fulfilling its All-Time Max, Min, Mean and Mode Temperature Guarantee™.
Write a class TempTracker with these methods:
Optimize for space and time. Favor speeding up the getter methods getMax(), getMin(), getMean(), and getMode() over speeding up the insert() method.
getMean() should return a double, but the rest of the getter methods can return integers. Temperatures will all be inserted as integers. We'll record our temperatures in Fahrenheit, so we can assume they'll all be in the range .
If there is more than one mode, return any of the modes.
Log in or sign up with one click to get immediate access to 3 free mock interview questions
We'll never post on your wall or message your friends.
Actually, we don't support password-based login. Never have. Just the OAuth methods above. Why?
time for each method, and space related to input! (Our occurrences vector's size is bounded by our range of possible temps, in this case 0-110)
Log in or sign up with one click to get immediate access to 3 free mock interview questions
We'll never post on your wall or message your friends.
Actually, we don't support password-based login. Never have. Just the OAuth methods above. Why?
There's at least one way to use a just-in-time approach, have time for each operation, and keep our space cost at for inserts. How could we do that?
Reset editor
Powered by qualified.io