Skip to content

Practice Complex Number Multiplication

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#537
LeetCode Problem

Complex Number Multiplication

Problem Statement

Multiply two complex numbers supplied as strings in the form real+imaginaryi. Both real and imaginary coefficients are integers from -100 through 100, and i^2 = -1. Return the product using the same format, including the plus separator even when the imaginary coefficient is negative.

Source: Complex Number Multiplication on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
num1 = "1+1i", num2 = "1+1i"
Output
"0+2i"

# Example 2

Input
num1 = "1+-1i", num2 = "1+-1i"
Output
"0+-2i"

Constraints

num1 and num2 are valid complex numbers.

Related LeetCode Problems

Practice more problems similar to Complex Number Multiplication.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.