---
# System prepended metadata

title: '**Leetcode筆記(Two Sum III - Data structure design)**'
tags: [easy, design, leetcode]

---

# **Leetcode筆記(Two Sum III - Data structure design)**


:::info
:information_source: 題目 : Two Sum III - Data structure design, 類型 : design , 等級 : medium
日期 : 2024/10/09
:::


### 嘗試
練習design的源起，是因為面試爆掉..
嘗試練習把leetcode模板刪掉，只看文字題目+下面實例/方法，實作出整個class/method
希望下次面試會更好!!
```python
class TwoSum:
    def __init__(self):
        self.record = []

    def add(self, number):
        self.record.append(number)

    def find(self, value):
        visited = set()
        for n in self.record:
            if value - n in visited:
                return True
            visited.add(n)
        return False

# class TwoSum:
#     def __init__(self):
#         
#     def add(self, number: int) -> None:
#         
#     def find(self, value: int) -> bool:
#         
# # Your TwoSum object will be instantiated and called as such:
# # obj = TwoSum()
# # obj.add(number)
# # param_2 = obj.find(value)
```

---
### **優化**

```python


```
---



**思路**


**講解連結**

Provided by. 
