Complex Number Multiplication - Practice Coding | SlaveCode
0
0123456789
0
0123456789
:
0
0123456789
0
0123456789
537. Complex Number Multiplication
Medium
30 Points
Math
String
Simulation
A complex number can be represented as a string on the form "real+imaginaryi" where:
Given two complex numbers num1 and num2 as strings, return a string of the complex number that represents their multiplications.
Examples
Example 1
Input: num1 = "1+1i", num2 = "1+1i"
Output: "0+2i"
Explanation: (1 + i) * (1 + i) = 1 + i2 + 2 * i = 2i, and you need convert it to the form of 0+2i.
Example 2
Input: num1 = "1+-1i", num2 = "1+-1i"
Output: "0+-2i"
Explanation: (1 - i) * (1 - i) = 1 + i2 - 2 * i = -2i, and you need convert it to the form of 0+-2i.
Constraints
num1 and num2 are valid complex numbers.
537. Complex Number Multiplication
Medium
30 Points
Math
String
Simulation
A complex number can be represented as a string on the form "real+imaginaryi" where:
Given two complex numbers num1 and num2 as strings, return a string of the complex number that represents their multiplications.
Examples
Example 1
Input: num1 = "1+1i", num2 = "1+1i"
Output: "0+2i"
Explanation: (1 + i) * (1 + i) = 1 + i2 + 2 * i = 2i, and you need convert it to the form of 0+2i.
Example 2
Input: num1 = "1+-1i", num2 = "1+-1i"
Output: "0+-2i"
Explanation: (1 - i) * (1 - i) = 1 + i2 - 2 * i = -2i, and you need convert it to the form of 0+-2i.