发帖数: 1 | 1 小白路过,学习了。
第一题是leetcode 271道.
public class Solution {
public String serialize(List strs) {
if (strs == null) return null;
StringBuffer ret = new StringBuffer();
for (String s : strs) ret.append(s.replace("#", "##")).append(" # ");
return ret.toString();
}
public List deserialize(String s) {
if (s == null) return null;
List ret = new ArrayList();
String[] array = s.split(" # ", -1);
for (int i = 0; ... 阅读全帖 |
|