logic:
N=3.. k=5th(position).length...
no. of setbit :0...
000 k =5
no. of setbit :1.. on every loop get next number of same number of bits and
decrement k by 1.
001k = 4
010k=3
100k= 2
no. of setbit: 2
011 k=1..
101
110
Therefore answer is 011
complexity : O(n)...
code::
#include stdio.h
#includeconio.h
void check(int count, int k,int max)
{
int right,leftmost,rightmost;
if(k==1)
return;
right=count(-count);
leftmost=count+right;
rightmost=count^leftmost;
rightmost=rightmost/right;
rightmost=rightmost2;
is this contest still going? if so, where ? i have a solution that
does
(100, 1267650600228229401496703205376 )(just one hundred 1's)
in 0.03 seconds in an older ruby on an older pc
I'd like to submit ;P
On Oct 21, 10:48 pm, sunny agrawal sunny816.i...@gmail.com wrote:
yea i know 1st
the contests are over... this was a question asked in a college...
but now that you have already written such an awesome code, would you mind
sharing it??? or atleast the algorithm of your code???
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
@icy
It's still there except that you'll get a different question.
That page promises you a telephone interview if you solve the challenge
but I don't know how true that is for non-US guys ..
i solved one question two weeks back .. and no one contacted me till now ..
~raju
On Tue, Oct 25, 2011