forked from wuduhren/leetcode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
My Leetcode practice. Python solution with explanation.
License
codeAligned/leetcode-python
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
#https://leetcode.com/problems/license-key-formatting/ class Solution(object): def licenseKeyFormatting(self, S, K): r = '' s = S.replace('-', '').upper() #cut first part of string remainder = len(s)%K if remainder!=0: r = s[:remainder]+'-' s = s[remainder:] while len(s)>0: r += s[:K]+'-' s = s[K:] #remove last '-' r = r[:-1] return r
About
My Leetcode practice. Python solution with explanation.
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Python 100.0%