l = 8            1 0 0 0
k = 6           0 1 1 0
xor              1 1 1 0
difference = 2

l = 16        1 0 0 0 0
k = 4         0 0 1 0 0
xor


On Sat, Jul 2, 2011 at 2:09 PM, sunny agrawal <sunny816.i...@gmail.com>wrote:

> yes i have written that only
> difference between indexes of first set bit and last set bit
>
> On Sat, Jul 2, 2011 at 2:08 PM, cegprakash <cegprak...@gmail.com> wrote:
>
>> whats mean by first set bit and last set bit? do you simply mean the
>> index of first and last bit?
>>
>> On Jul 2, 1:25 pm, sunny agrawal <sunny816.i...@gmail.com> wrote:
>> > xor the length of the rope with the required length and difference
>> between
>> > the indexes of first set and last set bit *may* be the answer !!
>> >
>> >
>> >
>> > On Sat, Jul 2, 2011 at 1:46 PM, cegprakash <cegprak...@gmail.com>
>> wrote:
>> > > nope
>> >
>> > > On Jul 2, 1:14 pm, keyan karthi <keyankarthi1...@gmail.com> wrote:
>> > > > yup :)
>> >
>> > > > On Sat, Jul 2, 2011 at 1:38 PM, Shalini Sah <
>> > > shalinisah.luv4cod...@gmail.com
>> >
>> > > > > wrote:
>> > > > > i guess the no. of 1s in the binary representation of the number
>> is the
>> > > > > answer..for 6 its 2...
>> >
>> > > > > On Sat, Jul 2, 2011 at 1:32 PM, cegprakash <cegprak...@gmail.com>
>> > > wrote:
>> >
>> > > > >> the length of the rope is l units.
>> > > > >> I can only cut any rope into two halves.
>> >
>> > > > >> for example if the length of the rope is 8 and we need a length
>> of
>> > > > >> rope 6
>> >
>> > > > >> we first cut into two halves and we get 4, 4
>> > > > >> now we cut any of the half again and we get 4,2,2
>> >
>> > > > >> now we can merge 4 and 2 and form a rope of length 6.
>> >
>> > > > >> in this example we need a minimum of 2 cuts to get the length of
>> rope
>> > > > >> 6 from 8
>> >
>> > > > >> assume that l is always a power of 2 and we need always a even
>> length
>> > > > >> of rope from it how to find the number of minimum cuts needed to
>> get
>> > > > >> the new rope?.
>> >
>> > > > >> --
>> > > > >> You received this message because you are subscribed to the
>> Google
>> > > Groups
>> > > > >> "Algorithm Geeks" group.
>> > > > >> To post to this group, send email to algogeeks@googlegroups.com.
>> > > > >> To unsubscribe from this group, send email to
>> > > > >> algogeeks+unsubscr...@googlegroups.com.
>> > > > >> 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 algogeeks@googlegroups.com.
>> > > > > To unsubscribe from this group, send email to
>> > > > > algogeeks+unsubscr...@googlegroups.com.
>> > > > > 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 algogeeks@googlegroups.com.
>> > > To unsubscribe from this group, send email to
>> > > algogeeks+unsubscr...@googlegroups.com.
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/algogeeks?hl=en.
>> >
>> > --
>> > Sunny Aggrawal
>> > B-Tech IV year,CSI
>> > Indian Institute Of Technology,Roorkee
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> Sunny Aggrawal
> B-Tech IV year,CSI
> Indian Institute Of Technology,Roorkee
>
>


-- 
Sunny Aggrawal
B-Tech IV year,CSI
Indian Institute Of Technology,Roorkee

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to