[InterviewBit] Serialize

Serialize

  • Time :
  • Space :
1
2
3
4
5
6
7
8
9
10
string Solution::serialize(vector<string> &A) {
string res = "";
for(auto a : A) {
res += a;
res += to_string(a.length());
res += "~";
}
return res;
}

Author: Song Hayoung
Link: https://songhayoung.github.io/2022/11/10/PS/interviewbit/serialize/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.