We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e37ef27 commit 5dc17a7Copy full SHA for 5dc17a7
Math/537.md
@@ -0,0 +1,28 @@
1
+## 537 Complex Number Multiplication
2
+
3
+#### Description
4
5
+[link](https://leetcode.com/problems/complex-number-multiplication/)
6
7
+---
8
9
+#### Solution
10
11
+- See Code
12
13
14
15
+#### Code
16
17
+<!-- O(n) -->
18
19
+```python
20
+class Solution:
21
+ def complexNumberMultiply(self, a: str, b: str) -> str:
22
+ def get_int(x):
23
+ n, m = x.split('+')
24
+ return int(n), int(m[:-1])
25
+ a_a, a_b = get_int(a)
26
+ b_a, b_b = get_int(b)
27
+ return str(a_a*b_a - a_b*b_b) + "+" + str(a_b*b_a + a_a*b_b) + "i"
28
+```
0 commit comments