Skip to content

Commit 93d393f

Browse files
committed
feat: Solve encode-and-decode-strings problem
1 parent d81cc20 commit 93d393f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution:
2+
"""
3+
@param: strs: a list of strings
4+
@return: encodes a list of strings to a single string.
5+
"""
6+
def encode(self, strs):
7+
return "secretKey!@#".join(strs)
8+
9+
"""
10+
@param: str: A string
11+
@return: decodes a single string to a list of strings
12+
"""
13+
def decode(self, str):
14+
return str.split("secretKey!@#")

0 commit comments

Comments
 (0)