Loading [MathJax]/jax/output/HTML-CSS/jax.js
[InterviewBit] Serialize

Serialize

  • Time : O(n)
  • Space : O(n)
c++
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.

Related Issues not found

Please contact @SongHayoung to initialize the comment