Microsoft SDE Real Interview Question: Convert a Base-10 Number in a Linked List to Any Arbitrary Base

16 Views
No Comments
Given a base 10 number represented by a linked list, change it to an arbitrary base.

Method:
Node ConvertBase(Node input, int base)

Tests:
{0} -> {0} in all bases

{1}->{0} = {1}->{0}->{1}->{0} binary

{1}->{0} = {1}->{2} octal

{1}->{0} = {a} hexadecimal

This problem tests arbitrary-base conversion where the number is stored as a linked list. The core idea is to extract the base-10 value, then repeatedly apply modulo and division to build the new-base list. It evaluates understanding of linked-list big-integer representation and digit extraction logic.

The VOprep team has long accompanied candidates through various major company OAs and VOs, including Google, Amazon, Citadel, SIG, providing real-time voice assistance, remote practice, and interview pacing reminders to help you stay smooth during critical moments. If you are preparing for these companies, you can check out our customized support plans—from coding interviews to system design, we offer full guidance to help you succeed.

END
 0