347. Multiply Two Numbers Represented as Linked Lists

EasyLinked ListLinked ListMathBig Number

Two non-negative integers are each represented as a singly linked list of digits (head = most significant digit). Multiply them and return the product as an integer.

Input: Two linked lists of single digits [0-9], head = most significant digit.

Output: Integer product of the two numbers.

Examples

Example 1
Input: [1,2,3], [4,5,6]
Output: 56088
Explanation: 123 x 456 = 56088.
Example 2
Input: [9,9,9], [9,9,9]
Output: 998001
Explanation: 999 x 999 = 998001.
Example 3
Input: [0], [5]
Output: 0
Explanation: 0 x 5 = 0.

Constraints

Asked by

TCSInfosysWiproCognizantCapgemini
Solve this problem in the editor →