We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
String Reduction
String Reduction
Sort by
recency
|
66 Discussions
|
Please Login in order to post a comment
Python:
Here is my solution in java, javascript, python, C, C++, Csharp HackerRank String Reduction Problem Solution
Here is String Reduction problem solution - https://programs.programmingoneonone.com/2021/07/hackerrank-string-reduction-problem-solution.html
l = [s.count('a'),s.count('b'),s.count('c')) while(l.count(0)<2): l.sort(reverse=True) l[0]-=1 l[1] -= 1 l[2] += 1 return max(l)