Skip to content

Commit

Permalink
Create 1653. Minimum Deletions to Make String Balanced.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahesh-addagatla authored Jul 30, 2024
1 parent 776968d commit 15a0f9f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions 1653. Minimum Deletions to Make String Balanced.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Solution {
public int minimumDeletions(String s) {
int c=0,ans=0;
for(char ch:s.toCharArray()){
if(ch=='b')c++;
else if(c!=0){
ans++;
c--;
}
}
return ans;
}
}

0 comments on commit 15a0f9f

Please sign in to comment.