-
Notifications
You must be signed in to change notification settings - Fork 3
leetcode solutions
License
Unknown, Unknown licenses found
Licenses found
Unknown
license-key-formatting.cpp
Unknown
license-key-formatting.scala
amitbansal7/leetcode
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
//Runtime: 12 ms class Solution { public: string licenseKeyFormatting(string S, int K) { string s = ""; for (char c : S) { if (c != '-') { s += toupper(c); } } if (s.size() == 0) return ""; string res = s.substr(0, s.size() % K); s = s.substr(s.size() % K); for (int i = 0; i < s.size(); i++) { if (res.size() > 0 && i % K == 0) { res += '-'; } res.push_back(s[i]); } return res; } };
About
leetcode solutions
Topics
License
Unknown, Unknown licenses found
Licenses found
Unknown
license-key-formatting.cpp
Unknown
license-key-formatting.scala
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published