Skip to content

Commit

Permalink
Refactor solution to "Minimum Length of String After Operations" problem
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoval committed Jan 13, 2025
1 parent 3d65aef commit 7fa0063
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public int minimumLength(String s) {

var ans = 0;
for (var count : counts) {
if (count < 3) {
ans += count;
} else {
if (count > 0) {
ans += (count % 2 == 0) ? 2 : 1;
}
}
Expand Down

0 comments on commit 7fa0063

Please sign in to comment.