Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 502 Bytes

File metadata and controls

16 lines (13 loc) · 502 Bytes

use the length of the string
encode to format:
length of string + special character(not a number) + original string

for both encode and decode:
time: O(n)
space: O(n)

when the splitter character appears we can encode that letter into:
escapte character + splitter

for both encode and decode:
time: O(n)
space: O(n)