Tesla Interview Question

Implement malloc_aligned(size_t size, size_t alignment) where alignment is power of 2

Interview Answers

Anonymous

Oct 29, 2017

Just boils down to return (malloc(size + alignment) + alignment) & (alignment - 1)

4

Anonymous

Feb 1, 2021

There's quite an extended back and forth in actual interviews for questions like this, so nothing quite like real practice. The Prepfully Tesla Firmware Engineer experts have actually worked in this role, so they're able to do an honest-to-God accurate mock, which really puts you through the paces. prepfully.com/practice-interviews

1