We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 63a05ff commit c03a5faCopy full SHA for c03a5fa
encode-and-decode-strings/hajunyoo.py
@@ -0,0 +1,18 @@
1
+class Solution1:
2
+ """
3
+ @param: strs: a list of strings
4
+ @return: encodes a list of strings to a single string.
5
6
+ # time complexity: O(n)
7
+ # space complexity: O(1)
8
+ def encode(self, strs):
9
+ return ":;".join(strs)
10
+
11
12
+ @param: str: A string
13
+ @return: decodes a single string to a list of strings
14
15
16
17
+ def decode(self, str):
18
+ return str.split(":;")
0 commit comments