@Ashita,
Your logic is fine for one vs one game, but as per question it's one vs
many game
Any idea what is that ?
Mohit
On Sat, Sep 25, 2010 at 1:18 PM, ashita dadlani ash@gmail.com wrote:
1.The soldiers are initially placed at row 2 or row 7th(each-one of white
and either of
Yes , i. Can , and i did , but is't there a shortcut . I want to know that
2010/9/24, mohit ranjan shoonya.mo...@gmail.com:
Dear Rahul,
Can you try writing hex digits in binary and try.
0x77 -- 0111 0111
0x03 -- 0011
---
AND 0011 -- 0x03
@yellow
your code turns 1000,100,10,2270,12130 to 1,1,1,27,123 repectively
simply it removes all trailing zeros ...
On Wed, Sep 22, 2010 at 8:10 PM, Yellow Sapphire pukhraj7...@gmail.comwrote:
My Solution.
Almost same as above but the flag is set by using bits.
#define SETFLAG(flag,
Here's the code
int rem_dup(int n)
{
int *a,i,c,t,d,count[10]={0},arr[20],j=0,sum=0;
a=(int *)malloc(sizeof(a));
for(i=0;n0;i++)//storing each digit of number in an array
{
a[i]=n%10;
n=n/10;
}
c=d=i-1;
i=0;
while(ic)//reversing the array
{
Q: Write an algorithm to compute the next multiple of 8 for a given
positive integer using bitwise operators.
Example,
(a) For the number 12, the next multiple of 8 is 16.
(b) For the number 16, the next multiple of 8 is 24.
-
I have written a code using bitwise
Basically, I am starting from (ans=)0 checking if it has become
greater than n, if not repeat(means, add 8) else answer is found.
--
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.
http://michael.dipperstein.com/rle/index.html
Step 1. Set the previous symbol equal to an unmatchable value.
Step 2. Read the next symbol from the input stream.
Step 3. If the symbol is an EOF exit.
Step 4. Write out the current symbol.
Step 5. If the
Example,
(a) For the number 12, the next multiple of 8 is 16.
(b) For the number 16, the next multiple of 8 is 24.
did u mean next multiple of 8 greater than given number(12 or 16). ?
On Sat, Sep 25, 2010 at 5:28 PM, Krunal Modi krunalam...@gmail.com wrote:
Basically, I am starting from
let the number be x .
solution = x - (x%8) + 8;
--
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 group, send email to
solution = ((x3) + 1)3;
On Sat, Sep 25, 2010 at 5:45 PM, Rahul Singal rahulsinga...@gmail.comwrote:
let the number be x .
solution = x - (x%8) + 8;
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
The answer would be:
(log1+1) + (log2+1) + (log3+1) + (log4+1) + ... + (log(n-1)+1)
which is equal to:
(log1+log2+log3+...+log(n-1)) + (n-1)
== *log((n-1)!) + (n-1)*
where, log everywhere is assumed to be in base 2
*This according to me will be the final answer!*
*
*
*Cheers*
*Nikhil Jindal
*
On
this wont work if x=24 i.e.multiple of 8
On Sep 25, 6:00 pm, Baljeet Kumar baljeetk...@gmail.com wrote:
solution = ((x3) + 1)3;
On Sat, Sep 25, 2010 at 5:45 PM, Rahul Singal rahulsinga...@gmail.comwrote:
let the number be x .
solution = x - (x%8) + 8;
--
You received this message
scan last(left) 4 bits .if the bits are not 1000.make them 1000.else
scan from left till u find first one(1).make this bit 1.and make
last(left) bits as 1000
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
How would you identify a binary search tree of maximum nodes in a binary
tree ?
--
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 group, send email to
answer = (x || 7) + 1;
Dave
On Sep 25, 6:56 am, Krunal Modi krunalam...@gmail.com wrote:
Q: Write an algorithm to compute the next multiple of 8 for a given
positive integer using bitwise operators.
Example,
(a) For the number 12, the next multiple of 8 is 16.
(b) For the number 16, the
Simpler: answer = (x || 7) + 1
Dave
On Sep 25, 10:14 am, rajess rajess1...@yahoo.com wrote:
scan last(left) 4 bits .if the bits are not 1000.make them 1000.else
scan from left till u find first one(1).make this bit 1.and make
last(left) bits as 1000
--
You received this message because you
I agree with Nishant.
For inplace replacement we need to swap two place for that we need
index, which is not possible without additional variables.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
My code failed because it was reversing the digits and thus 0 was getting
added in the front which resulted in nothing.
If allowed we can use a char array else will have to find a solution which
does not reverse the digits of the number.
--
You received this message because you are subscribed
please let me know solution using extra memory.
--
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 group, send email to
@albert
why r u asking for a non optimal solution??
On Sat, Sep 25, 2010 at 11:24 PM, albert theboss alberttheb...@gmail.comwrote:
please let me know solution using extra memory.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To
@rajess
It works for all the cases.
On Sat, Sep 25, 2010 at 8:42 PM, rajess rajess1...@yahoo.com wrote:
this wont work if x=24 i.e.multiple of 8
On Sep 25, 6:00 pm, Baljeet Kumar baljeetk...@gmail.com wrote:
solution = ((x3) + 1)3;
On Sat, Sep 25, 2010 at 5:45 PM, Rahul Singal
Here is another approach. Remove the first character. Reverse the
rest of the string recursively. Append the character at the end.
Others have given solutions along these lines, but they have various
mistakes. Here's one that I believe is correct. As pointed out
already, this is not a good
If +,-,*,/ is completely forbidden, I think at least one loop is needed.
Here is my solution:
int next8mult (int n)
{
n = (n ~7);// clear the least 3 bit to make
multiple of 8
int r = 8;
while(r) { // add 8 to n
int r1 = (nr) 1; // get
@Dave
very nice one line solution..
we all are revolving around x3 concept...
On Sat, Sep 25, 2010 at 10:17 PM, Dave dave_and_da...@juno.com wrote:
answer = (x || 7) + 1;
Dave
On Sep 25, 6:56 am, Krunal Modi krunalam...@gmail.com wrote:
Q: Write an algorithm to compute the next
No parody .. that would be another doubt :(
On Sat, Sep 25, 2010 at 11:03 PM, prodigy 1abhishekshu...@gmail.com wrote:
By maintaining a current maximum and a global maximum. You do know how
to verify a BT is BST .
http://pastebin.com/xwXXTEnP
On Sep 25, 9:04 pm, mac adobe
@parody :..and how would that find me a maximum size BST .. ??
( for checking if this BT is BST i would do inorder traversal and see if it
is increasing )
On Sun, Sep 26, 2010 at 11:10 AM, mac adobe macatad...@gmail.com wrote:
No parody .. that would be another doubt :(
On Sat, Sep
Simple one line solution without looping and efficient :
i=(i7)?(i|7)+1:i)
On Sun, Sep 26, 2010 at 8:43 AM, coolfrog$
dixit.coolfrog.div...@gmail.comwrote:
@Dave
very nice one line solution..
we all are revolving around x3 concept...
On Sat, Sep 25, 2010 at 10:17 PM, Dave
@Saurab: Nice solution
On Sun, Sep 26, 2010 at 11:27 AM, saurabh agrawal saurabh...@gmail.comwrote:
Simple one line solution without looping and efficient :
i=(i7)?(i|7)+1:i)
On Sun, Sep 26, 2010 at 8:43 AM, coolfrog$
dixit.coolfrog.div...@gmail.com wrote:
@Dave
very nice one line
28 matches
Mail list logo