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 ba05d0e commit 6230c4aCopy full SHA for 6230c4a
encode-and-decode-strings/yolophg.js
@@ -0,0 +1,14 @@
1
+// Time Complexity: O(n), O(n)
2
+// Space Complexity: O(n), O(n)
3
+
4
+class Solution {
5
+ encode(strs) {
6
+ // join the array into a single string using a delimiter, '|'.
7
+ return strs.join('|');
8
+ }
9
10
+ decode(str) {
11
+ // split the string using the delimiter '|' and return the array.
12
+ return str.split('|');
13
14
+}
0 commit comments