Code RoomBase conversion
MediumPrep Room Coding #982

Base conversion

CodingAlgorithms & data structuresMid–Senior~20 min

Given a non-negative number represented as an uppercase string num_str in base from_base, convert it to base to_base and return the result as an uppercase string. Both bases are between 2 and 16 inclusive; digits above 9 use letters A-F. The value fits in 64 bits. Zero must convert to the string '0'. For example ('FF', 16, 2) returns '11111111'.

Implement
convert_base(num_str: str, from_base: int, to_base: int) → str
Examples
in["FF",16,2]out"11111111"
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 20 min
InputExpectedGot
["FF",16,2]"11111111"not run yetsample