Chef Loves Beautiful Strings (Easy Version) | CodeChef Starters 149 | ZXC | Explanation Hindi

preview_player
Показать описание
Hey this video is a part of upsolving session of Codechef Starters 149 (Div 2). Hope you would understand the problem and the approach for it. If you still have any doubts, feel free to put it into the comment box. Looking forward to see you in the next one !!!

Your Queries :
Codechef
Codechef Solutions
Codechef Starters
Codechef Starters Solution
Codechef C++ solution
Codechef Starters 149
Codechef Starters 149 solution
Codechef Starters 149 editorial
Codechef Starters 149 C++ Solution
Chef Loves Beautiful Strings (Easy Version)
Chef Loves Beautiful Strings (Easy Version) solution
Chef Loves Beautiful Strings (Easy Version) editorial
Chef Loves Beautiful Strings (Easy Version) codechef solution
Chef Loves Beautiful Strings (Easy Version) solution codechef
Chef Loves Beautiful Strings (Easy Version) solution c++
Рекомендации по теме
Комментарии
Автор

Great explanation 👍🏻
Can you do the optimal flip (starters 132) question please

snehayadav
Автор

101011 : 4
110101101: 27

Python Soln (with sum to n formula):

def soln():
n = int(input())
s = input()
score = 0
for i in range(n-1):
if s[i] != s[i+1]:
score += 1
res = score * (n - 1 - score)
res += (score)*(score-1)//2
return res

for tc in range(int(input())):
ans = soln()
print(ans)

bhai aapke kitne solve houe, kaya aap bata sakte hai?

rajkumardongre