- 6 more leetcode problems.
- Remember that sets are mutable in python, and therefore are not hashable.
- If you need to solve a problem with nested lists/sets, and you need to check if an inner list is already in the outer list, it’s slow. It’s much faster in a hash table (set or dict).
- To solve, make the outer and set and the inner a tuple. You can leave the inner a list for whenever you’re modifying it, but then you can convert to tuple when checking/writing to the outer set.
- Amazon onsites. 6 1-hr interviews. Notes in drive. Enjoyed it.
- Jack mentioned that Citadel is still putting together the onsite panel, so it’ll likely be next week not this week.
- ZYME up 4% and TSLA up 11% today (to $530, w t f). ZYME had a -15% dip right after open, lasted for about 30min. Not sure what caused it, some afterhours behavior, who knows.
- Collisions. Two writes at the same time. Databases, both relational and in-mem, have locking mechanisms. Under the hood, there is a mutex that will keep transactions from overwriting each other (if it’s an ACID database). If you have two REST calls trying to book an airbnb, the db will confirm one as first and return the write transaction; the other will fail. The service should then tell that to the user.
- Remember if your DB doesn’t have native support for a date/datetime object (like redis), just convert to an integer via seconds-since-epoch.