Skip to content

Commit 5b98f10

Browse files
committed
encode-and-decode-strings solution
1 parent c3847f1 commit 5b98f10

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

encode-and-decode-strings/lhc0506.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution {
2+
/**
3+
* @param {string[]} strs
4+
* @returns {string}
5+
*/
6+
encode(strs) {
7+
return JSON.stringify(strs);
8+
}
9+
10+
/**
11+
* @param {string} str
12+
* @returns {string[]}
13+
*/
14+
decode(str) {
15+
return JSON.parse(str);
16+
}
17+
}

0 commit comments

Comments
 (0)