Skip to content

Commit e100f50

Browse files
committed
Runtime: 70 ms (Top 48.18%) | Memory: 21.1 MB (Top 93.21%)
1 parent a4f2e41 commit e100f50

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1+
// Runtime: 70 ms (Top 48.18%) | Memory: 21.1 MB (Top 93.21%)
12
class Solution {
23
public:
34
string getSmallestString(int n, int k) {
45
string res(n, 'a');
56
k -= n;
6-
7+
78
int i = res.size() - 1;
89
while (k > 0) {
910
int tmp = min(k, 25);
1011
res[i] += tmp;
1112
k -= tmp;
1213
--i;
1314
}
14-
15+
1516
return res;
1617
}
1718
};

0 commit comments

Comments
 (0)