Skip to content

Commit 394dcb6

Browse files
refactor 271
1 parent d903a3d commit 394dcb6

File tree

1 file changed

+0
-32
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-32
lines changed

src/main/java/com/fishercoder/solutions/_271.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,6 @@
33
import java.util.ArrayList;
44
import java.util.List;
55

6-
/**
7-
* 271. Encode and Decode Strings
8-
*
9-
* Design an algorithm to encode a list of strings to a string.
10-
* The encoded string is then sent over the network and is decoded back to the original list of strings.
11-
12-
Machine 1 (sender) has the function:
13-
14-
string encode(vector<string> strs) {
15-
// ... your code
16-
return encoded_string;
17-
}
18-
Machine 2 (receiver) has the function:
19-
vector<string> decode(string s) {
20-
//... your code
21-
return strs;
22-
}
23-
So Machine 1 does:
24-
25-
string encoded_string = encode(strs);
26-
and Machine 2 does:
27-
28-
vector<string> strs2 = decode(encoded_string);
29-
strs2 in Machine 2 should be the same as strs in Machine 1.
30-
31-
Implement the encode and decode methods.
32-
33-
Note:
34-
The string may contain any possible characters out of 256 valid ascii characters. Your algorithm should be generalized enough to work on any possible characters.
35-
Do not use class member/global/static variables to store states. Your encode and decode algorithms should be stateless.
36-
Do not rely on any library method such as eval or serialize methods. You should implement your own encode/decode algorithm.
37-
*/
386
public class _271 {
397
public static class Solution1 {
408
// Encodes a list of strings to a single string.

0 commit comments

Comments
 (0)