### You only have free questions left (including this one).

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 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:

1. insert—records a new temperature
2. get_max—returns the highest temp we've seen so far
3. get_min—returns the lowest temp we've seen so far
4. get_mean—returns the mean of all temps we've seen so far
5. get_mode—returns a mode of all temps we've seen so far

Optimize for space and time. Favor speeding up the getter methods get_max, get_min, get_mean, and get_mode over speeding up the insert method.

get_mean should return a float, 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 0..110.

If there is more than one mode, return any of the modes.

We can get time for all methods.

We can get away with only using additional space. If you're storing each temperature as it comes in, be careful! You might be taking up space, where n is the number of temperatures we insert!

Are you trying to be fancy about returning multiple modes if there's a tie? Good idea, but read the problem statement carefully! Check out that last sentence!

Failing to carefully read or listen to the problem statement is a very common mistake, and it always looks bad. Don't let it happen to you.

### Start your free trial!

Actually, we don't support password-based login. Never have. Just the OAuth methods above. Why?

1. It's easy and quick. No "reset password" flow. No password to forget.
2. It lets us avoid storing passwords that hackers could access and use to try to log into our users' email or bank accounts.
3. It makes it harder for one person to share a paid Interview Cake account with multiple people.

### Start your free trial!

Actually, we don't support password-based login. Never have. Just the OAuth methods above. Why?

1. It's easy and quick. No "reset password" flow. No password to forget.
2. It lets us avoid storing passwords that hackers could access and use to try to log into our users' email or bank accounts.
3. It makes it harder for one person to share a paid Interview Cake account with multiple people.

time for each method, and space related to input! (Our occurrences list's size is bounded by our range of possible temps, in this case 0-110)

### Start your free trial!

Actually, we don't support password-based login. Never have. Just the OAuth methods above. Why?

1. It's easy and quick. No "reset password" flow. No password to forget.
2. It lets us avoid storing passwords that hackers could access and use to try to log into our users' email or bank accounts.
3. It makes it harder for one person to share a paid Interview Cake account with multiple people.

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 n inserts. How could we do that?

Reset editor