SnowScriptWinterOfCode / LeetCode_Q

Solve with us the most mind boggling DSA questions to ace your skills
2 stars 50 forks source link

Day 30 q3: Minimum deletion to make string balanced #624

Open Smita-Maurya opened 7 months ago

Smita-Maurya commented 7 months ago

You are given a string s consisting only of characters 'a' and 'b'​​​​.

You can delete any number of characters in s to make s balanced. s is balanced if there is no pair of indices (i,j) such that i < j and s[i] = 'b' and s[j]= 'a'.

Return the minimum number of deletions needed to make s balanced.

Example 1: Input: s = "aababbab" Output: 2 Explanation: You can either: Delete the characters at 0-indexed positions 2 and 6 ("aababbab" -> "aaabbb"), or Delete the characters at 0-indexed positions 3 and 6 ("aababbab" -> "aabbbb").

Tech-neophyte commented 7 months ago

Hey! Please assign this ques to me @bh-g

Kalpana8055 commented 7 months ago

@bh-g please assign to me