Implement a Memory Allocator, followup question afterwards
Anonymous
it was pretty much the same question as the one on Leetcode. there were two functions, malloc() and free() and I first implemented it with a linear scan solution, where we just found the first fit for the block. After implementing this O(n) solution, I implemented a best-fit strategy, where we found the smallest possible block that could fit the allocation, which I used heap in Python to solve this portion.
Check out your Company Bowl for anonymous work chats.