You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
415 B
26 lines
415 B
---
|
|
id: 6
|
|
title: String Compression and Decompression
|
|
topics: [string]
|
|
difficulty: easy
|
|
---
|
|
|
|
## Question
|
|
|
|
```
|
|
'''
|
|
Given a string, compress it by grouping repeated characters. The length after
|
|
compression must always be smaller than or equal to the original string.
|
|
|
|
'aaabbccc' => 'a3b2c3'
|
|
'''
|
|
```
|
|
|
|
```
|
|
'''
|
|
Given the above compressed string, decompress to obtain the original string.
|
|
|
|
'a3b2c3' => 'aaabbccc'
|
|
'''
|
|
```
|