Hi,

I think you can run a loop over array and in each iteration count the number
of 1's by masking with 1 and shifting the number. if number does not end
with zero then keep on counting ... else restart the count in next number
.... in each iteration compare the count with previous count......


Thanks and regards,
Gajendra Dadheech
Software Engineer-I (R&D)
----------------------------------------
MediaTek India Technology
Work: 120-4343900(Ext. 276)
Mobile: +91-9540646145
-----------------------------------------
"Be the change you want to see in the world" -Mohandas Gandhi



On Thu, Feb 10, 2011 at 2:32 PM, jalaj jaiswal <[email protected]>wrote:

>
> There is very long array of ints, and you are given pointer to base addr of
> this array.. each int is 16bit representation... you need to return the
> pointer to tht "bit" inside array where longest sequence of "1"s start
>
> take this simple example:
> Array = {15,7,2,1,0,23}
> 1111,0111,0010,0001,0000,10111
> ^
> Result: Pointer should point to 1st bit of number 15.
>
>
> another example : 1111,0111,0011,1110,0000,10111
>                                                _____
>                                             third index from starting is
> the answer i.e i=2 , if i start from 0 as it has maximum 1's(5)
> --
> With Regards,
> *Jalaj Jaiswal* (+919019947895)
> Software developer, Cisco Systems
> Final Year Undergraduate,
> IIIT ALLAHABAD
>
>  --
> 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.

Reply via email to