Skip to content

Commit 4ac2ae6

Browse files
authored
Update 0271-encode-and-decode-strings.py
1 parent 7a76b54 commit 4ac2ae6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

python/0271-encode-and-decode-strings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
class Codec:
22
def encode(self, strs):
3-
return ''.join(map(lambda s: f"{len(s)}#{s}", strs))
3+
res = ""
4+
for s in strs:
5+
res += str(len(s)) + "#" + s
6+
return res
47

58
def decode(self, s):
69
res = []

0 commit comments

Comments
 (0)