Chef And Groups || Codechef Long Challenge March 2021 || Solution Problem Approach & Extra Test Case

Опубликовано: 01 Апрель 2026
на канале: Aj
2,238
18

PAPARAZZI GENNADY 100 POINT FULL SOLUTION IN C++ :    • PAPARAZZI GANNADY || 100 Point Confirm || ...  
College Life 4 Full 100 Point Solution :    • COLLEGE LIFE 4 || 100 POINT CONFIRM || Cod...  

Interesting Xor 100 Point Optimized :    • Interesting XOR Optimized Solution || 100 ...  
College Life 4 Loop Based Solution :    • College Life 4 Loop Bases Solution  
Space Arrays :    • Space Arrays || 100 Point || SPACEARR ||  ...  
College Life 4 Greedy Approach :    • College Life 4 Greedy Approach | Full Solu...  
College Life 4 :    • College Life 4 || COLGLF4 || Codechef Marc...  
SPACE ARRAYS :    • SPACE ARRAYS || SPACEARR || Codechef long ...  
Interesting Xor :    • Interesting Xor || IRSTXOR || Full Solutio...  
Chef And Groups :    • Chef And Groups || Codechef Long Challenge...  
No Time To Wait :    • No Time To Wait || Approach, Idea, Code wi...  

March Long Challenge 2021 Solution Full Playlist :    • MARCH LONG CHALLENGE 2021 😍😍😍   Chef And Groups || Problem, Approach & Solution Discussed with Extra Test Cases

Problem
There are N seats in a row. You are given a string S with length N; for each valid i, the i-th character of S is '0' if the i-th seat is empty or '1' if there is someone sitting in that seat.

Two people are friends if they are sitting next to each other. Two friends are always part of the same group of friends. Can you find the total number of groups?

'0' -)) seat is empty
'1' -)) seat is full

means if two person are friends then they are setting two near to each other
In other word if

1111 -)) then this four are friend

we have to find total no. of group of friends
means
we have to find group of 1's present in the strings
so for that we iterate througth the string and if continuous 1's are coming we consider them as a group of friend and count that type of 1's in given string

INPUT :
3
000
010
101
OUTPUT :
0
1
2


EXTRA TEST CASES AND ANS
3
110011 == 2
010101 == 3
0011001101 == 3



THANK YOU ...

KEEP LEARNING
KEEP CODING :))))))