• Asked to answer
    + 1 comment

    HI, may be ur right that 5 doesnot contain any consecutive 1's in its binary form i.e 101(we use word 'consecutive' only if the occurence of item two or more times without any gap).For binary string of 15 answer is 4 because it has 4 consecutive 1's as u mentioned. for example if u sick for 4 continues days, and 5th day u ll say to ur friends that you was sick for 4 consecutive days (not 3 consicutive days). same way here answer is 4 not 3.

    following link may give support to ur doubt about 5 doesnot have consecutive 1's http://www.geeksforgeeks.org/count-number-binary-strings-without-consecutive-1s/

    Moderator should clarify this doubt. :-)