forked from SamirPaulb/LeetCode
-
Notifications
You must be signed in to change notification settings - Fork 0
ππ This is a concise Python 3 programming tutorial for people who think that reading is boring. I try to show everything with simple code examples.
SamirPaul1/Python-3
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Sorry, we had to truncate this directory to 1,000 files. 177 entries were omitted from the list. | ||||
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
ππ This is a concise Python 3 programming tutorial for people who think that reading is boring. I try to show everything with simple code examples.
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Python 78.0%
- C++ 18.3%
- HTML 2.7%
- Other 1.0%