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.
intbeautifulBinaryString(char*b){intcount=0;intlength=strlen(b);for(inti=0;i<=length-3;i++){// Check for the substring "010"if(b[i]=='0'&&b[i+1]=='1'&&b[i+2]=='0'){count++;// Skip the next two characters to avoid overlappingi+=2;}}returncount;}
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 →
Simple C Solution