Skip to content

Commit fc389be

Browse files
committed
667
1 parent b00375c commit fc389be

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Trie/667.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## 667 Map Sum Pairs
2+
3+
#### Description
4+
5+
[link](https://leetcode.com/problems/map-sum-pairs/description/)
6+
7+
---
8+
9+
#### Solution
10+
11+
See Code
12+
13+
---
14+
15+
#### Code
16+
17+
```python
18+
class MapSum:
19+
20+
def __init__(self):
21+
"""
22+
Initialize your data structure here.
23+
"""
24+
self.d = {}
25+
26+
def insert(self, key, val):
27+
self.d[key] = val
28+
29+
def sum(self, prefix):
30+
return sum(self.d[i] for i in self.d if i.startswith(prefix))
31+
```

0 commit comments

Comments
 (0)