@kartik also consider the case of GBGGGG the answer is 1 BGGGGG. ie trailing G's left. BBBBBGB leading B's left hence only one G followed by B therefore only one iteration.
try out some cases u will find hw it wrks. On Tue, Jun 28, 2011 at 12:42 AM, vaibhav agarwal < [email protected]> wrote: > @kartik > > yup frgt to mention the last case 1 followed by zero's in that case number > of iterations is the no. of trailing zeroes. > GBGBBB > will have four iterations > 101000 = 1(one zero b/w two ones) + 3(last 1 followed by 3 zero's) > > BGBGBB,BBGBGB,BBBGBG,BBBBGG > > well logic is how hw mny jump of 1's u need to do to get it to the end of > the sequence. > GBG requires 1 iteration ie BGG > > > On Mon, Jun 27, 2011 at 11:27 PM, kartik sachan > <[email protected]>wrote: > >> HEY DUDE I AM NOT GETTING UR LOGIC AT ALL I THINK HOW U WILL SATISFY THIS >> CASE GBGBBB >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
