forked from SamirPaulb/LeetCode
-
Notifications
You must be signed in to change notification settings - Fork 0
LeetCode Solutions💡in Python3🐍 and C++
Akatsuki-forks/LeetCode
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
class Solution(object): def licenseKeyFormatting(self, S, K): """ :type S: str :type K: int :rtype: str """ # https://leetcode.com/problems/license-key-formatting/discuss/96497/Python-solution S = S.upper().replace('-', '') ls = len(S) if ls % K == 0: pos = K else: pos = ls % K res = S[:pos] while pos < ls: res += '-' + S[pos:pos + K] pos += K return res
About
LeetCode Solutions💡in Python3🐍 and C++
Stars
Watchers
Forks
Packages 0
No packages published
Languages
- Python 67.6%
- C++ 32.4%