Skip to content

Commit 7a492f4

Browse files
committed
solved: 482. License Key Formatting
Signed-off-by: rajput-hemant <[email protected]>
1 parent a7be239 commit 7a492f4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
impl Solution {
2+
pub fn license_key_formatting(s: String, k: i32) -> String {
3+
let mut s = s.replace("-", "");
4+
let mut i = s.len() as i32 - k;
5+
6+
while i > 0 {
7+
s.insert(i as usize, '-');
8+
i -= k;
9+
}
10+
11+
s.to_uppercase()
12+
}
13+
}

0 commit comments

Comments
 (0)