Skip to content

Commit 62b0537

Browse files
committed
Time: 328 ms (5.93%), Space: 46.9 MB (7.08%) - LeetHub
1 parent 8f056bc commit 62b0537

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

2182-construct-string-with-repeat-limit/2182-construct-string-with-repeat-limit.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ public String repeatLimitedString(String s, int repeatLimit) {
77
StringBuilder op = new StringBuilder();
88
int prev=-1;
99
for(int i=25;i>=0;i--){
10-
11-
if(op.length()>=s.length()){
12-
break;
13-
}
10+
1411
if(freq[i]==0) continue;
1512

1613
if(op.length()>0 && op.charAt(op.length()-1)!=(char)('a' + i) && prev!=-1){
@@ -28,7 +25,6 @@ public String repeatLimitedString(String s, int repeatLimit) {
2825
else if(freq[i]>repeatLimit){
2926
freq[i]-=repeatLimit;
3027
op.append(genrate(repeatLimit,(char)('a' + i)));
31-
3228
prev=i;
3329
}
3430
}

0 commit comments

Comments
 (0)