your first approach is totally correct.
On Dec 22, 12:36 pm, juver++ avpostni...@gmail.com wrote:
Use bits manipulation tricks.
1. There is a way to remove a group of consecutive 1's from the right: A = n
(n + 1). Then check if A==0 then OK.
2. Second approach: B=n+1, check if B (B-1) (this
bits manipulation tricks is cool to solve these kind of questions.
On Sun, Dec 26, 2010 at 3:27 PM, Praveen Baskar praveen200...@gmail.comwrote:
Your Second approach is cool :)
On Wed, Dec 22, 2010 at 1:06 PM, juver++ avpostni...@gmail.com wrote:
Use bits manipulation tricks.
1. There is a
Your Second approach is cool :)
On Wed, Dec 22, 2010 at 1:06 PM, juver++ avpostni...@gmail.com wrote:
Use bits manipulation tricks.
1. There is a way to remove a group of consecutive 1's from the right: A =
n (n + 1). Then check if A==0 then OK.
2. Second approach: B=n+1, check if B (B-1)
Could be modelled as a deterministic finite statemachine to be checked in
linear time.
On 22 December 2010 07:47, snehal jain learner@gmail.com wrote:
@above
nice approach :)
On Wed, Dec 22, 2010 at 1:06 PM, juver++ avpostni...@gmail.com wrote:
Use bits manipulation tricks.
1. There
http://anandtechblog.blogspot.com/2010/12/sort-array-containing-1s-and-0s.html
On Wed, Dec 22, 2010 at 6:47 AM, Carl Barton odysseus.ulys...@gmail.comwrote:
Could be modelled as a deterministic finite statemachine to be checked in
linear time.
On 22 December 2010 07:47, snehal jain
This is simply a decision problem is it not?
the above sorting would require n log n for comparison sorting where as a
decision could be simply done in linear time and space.
Please correct me if i'm wrong
On 22 December 2010 19:17, Anand anandut2...@gmail.com wrote:
Problem mentioned by @investmentsupergro...@googlegroups.com is not
connected with the original problem.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this
Use bits manipulation tricks. There is a way to remove a group of
consecutive 1's from the right: A = n (n - 1). Then check A==0.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
@above
nice approach :)
On Wed, Dec 22, 2010 at 1:06 PM, juver++ avpostni...@gmail.com wrote:
Use bits manipulation tricks.
1. There is a way to remove a group of consecutive 1's from the right: A =
n (n + 1). Then check if A==0 then OK.
2. Second approach: B=n+1, check if B (B-1) (this