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.
here is my C solution: int c=0,i=0;
int beautifulBinaryString(char* b)
{
if(b[i]!='\0')
{
if(b[i]=='0' && b[i+1]=='1' && b[i+2]=='0')
{
c++;
i=i+3;
}
else{i++;}
beautifulBinaryString(b);
}
return c;
}
*
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Binary String
You are viewing a single comment's thread. Return to all comments →
here is my C solution: int c=0,i=0; int beautifulBinaryString(char* b) { if(b[i]!='\0') { if(b[i]=='0' && b[i+1]=='1' && b[i+2]=='0') { c++; i=i+3; } else{i++;} beautifulBinaryString(b); } return c; } *