Multiply Numbers as Strings

Talk it through out loud with your AI coach.

The problem

  • medium
  • Pro

Two non-negative whole numbers are given as strings of digits, possibly hundreds of digits long. Return their product as a string, without converting either string to a built-in number type. Explain your approach.

What a strong answer covers

  • Turning the method taught at school into a program.
  • How big the answer can be, and where each partial product goes.
  • Cleaning up the result, including a zero input.
  • Time and space in terms of the two lengths.

Common mistake: Converting the strings to built-in integers, which overflows for long inputs and ignores the point of the question.

Knowing this is half of it. Saying it clearly out loud is the part the coach helps you practise.

Practise it out loud