
def runLengthEncoding(string):
c = string[0]
n = 0
st = ""
for ch in string:
if (c != ch or n > 8):
st += (str(n) + c)
c = ch
n = 1
else:
n +=1
return st + str(n) + c'Algorithms and Data Structures > Coding Practices' 카테고리의 다른 글
| AlgoExpert Selection Sort (0) | 2022.07.19 |
|---|---|
| AlgoExpert Cipher Encryptor (0) | 2022.07.19 |
| AlgoExpert First Non-Repeating Character (0) | 2022.07.17 |
| LeetCode 1029. Two City Scheduling (0) | 2022.07.17 |
| LeetCode 3. Longest Substring Without Repeating Characters (0) | 2022.07.16 |