Skip to content

Commit 5dc17a7

Browse files
committed
53y
1 parent e37ef27 commit 5dc17a7

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Math/537.md

+28
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)