Medium data structure and algorithm practice puzzle.
A buddy allocator only deals in blocks whose sizes are powers of two. To serve a request it takes the smallest power of two that is at least the request, and if its one free block is larger, it splits that block in half again and again until a piece of the right size appears. Given the size of the single free block, a power of two, and a request of at least 1, return the block size handed out and the number of splits, or [-1, -1] if the request is too large.
Solve it three ways: snap the jigsaw pieces together, fill in the blanks, or type it from scratch against the tests. This one is free to play, with no account.
Every line of the solution comes with a note explaining why it is there, and a step by step replay shows the code running. At level 3, where you type it yourself, you can ask for an AI mock interview on this problem that ends with a hiring manager's scorecard.
Then grow it into a real project with the Software Engineer button: this puzzle becomes the Reading Integrity Check, a pipeline you can run and download. See every Software Engineer project.