首页>itarticle>[lintcode] problem 659 – encode and decode strings
[lintcode] problem 659 – encode and decode strings
admin11月 13, 20200
Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list of strings.
Please implement encode and decode
Example
No.1
Input: [“lint”,”code”,”love”,”you”]
Output: [“lint”,”code”,”love”,”you”]
Explanation: One possible encode method is: “lint:;code:;love:;you”
No.2
Input: [“we”, “say”, “:”, “yes”]
Output: [“we”, “say”, “:”, “yes”]
Explanation: One possible encode method is: “we:;say:;:::;yes”
近期评论