-
Notifications
You must be signed in to change notification settings - Fork 89
License
yingl/LintCodeInPython
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
class Solution:
"""
@param S: a string
@param K: a integer
@return: return a string
"""
def licenseKeyFormatting(self, S, K):
# write your code here
ret = []
count = 0
for i in range(len(S) - 1, -1, -1):
if S[i] != '-':
count += 1
ret.append(S[i].upper())
if (count % K) == 0:
ret.append('-')
if ret[-1] == '-':
ret.pop()
ret.reverse()
return ''.join(ret)
# easy: https://www.lintcode.com/problem/license-key-formatting/
About
No description, website, or topics provided.
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published