The lights in the conference room flickered intermittently, a slight buzz heard each time they dimmed. Something was dripping on to the ceiling tiles from above, a large orange colored stain had developed in the corner.
The interviewer leaned in again, his tie loose, his face covered in stubble. He'd been at this for four hours now and it was showing.
"Tell us your social media passwords."
The candidate flinched back, shaking his head.
"I told you, I...that's illegal, you can't ask for those."
The interviewer clasped his hands together, cracked his knuckles, and flashed a big grin. With a swift motion he swiped a marker from the table, flicked off the cap, and stabbed it in the direction of the candidate.
"Write a linked-list implementation in C. Oh, and because you've been such a tough-guy you only get to use malloc...once. In the main function."
A bead of sweat quickly ran down the candidate's face. He looked tense, fraught with concern. The sound of his teeth grinding together wasn't hard to hear.
for single linked list you can just use an array of the struct and borrow/return via circular list.
my C is beyond the rust levels of 20y Golf 2 but I guess I won't sweat over.
An alternative solution would be cheating away and using realloc instead of malloc.
The interviewer leaned in again, his tie loose, his face covered in stubble. He'd been at this for four hours now and it was showing.
"Tell us your social media passwords."
The candidate flinched back, shaking his head.
"I told you, I...that's illegal, you can't ask for those."
The interviewer clasped his hands together, cracked his knuckles, and flashed a big grin. With a swift motion he swiped a marker from the table, flicked off the cap, and stabbed it in the direction of the candidate.
"Write a linked-list implementation in C. Oh, and because you've been such a tough-guy you only get to use malloc...once. In the main function."
A bead of sweat quickly ran down the candidate's face. He looked tense, fraught with concern. The sound of his teeth grinding together wasn't hard to hear.
"S-seven salamander six exclamation three five."