Redirect your output to the file, and you'll see that at the end of line you
have extra blank.
You need to write something like this (in all sections):
for(i=j;i<(j+2*C-1);i++) {
if (i != j) printf(" ");
printf("%d",s[i]); // note there is no space
}
--
You received this message because you ar
i improved upon my code but still i get a presentation error dunno wts the
judge judging it shows me the correct way when i output test cases on my
compiler but on the judge it says wrong answer or presentation error
#include
#include
#include
#include
#include
using namespace std;
int prime(int
Yes, Following should do for next smallest:
1. Find rightmost 01 pair
2. swap these two bits (make it 10)
e.g.
N=3(011), Next smallest: 5(101)
N=10(1010), Next smallest: 12(1100)
N=14(01110), Next Smallest: 22(10110)
On Jan 18, 12:48 am, juver++ wrote:
> @abobe
> my solution is wrong when number
Yes, I guess following correction in step 1 for Next Smallest should
fix it:
1. Find the leftmost 1 [ Not rightmost].
On Jan 18, 12:48 am, juver++ wrote:
> @abobe
> my solution is wrong when number is even (but it can be avoided with some
> corrections into an implementation),
> btw, you have a m
Yes, I guess following correction in step 1 for Next Smallest should
fix it:
1. Find the leftmost 1 [ Not rightmost].
On Jan 18, 12:48 am, juver++ wrote:
> @abobe
> my solution is wrong when number is even (but it can be avoided with some
> corrections into an implementation),
> btw, you have a m
@abobe
my solution is wrong when number is even (but it can be avoided with some
corrections into an implementation),
btw, you have a mistake: N=3(011), Next smallest: 6(110) ,* Should be 101
(5)!*
In other cases my version is correct.
--
You received this message because you are subscribed t
Q1 is very well answered by Sunny but looks like Q2 is still open.
IMHO, juver++ soln on Q2 doesn't look correct to me (OR I didn't
understand the problem).
if given no is N=2 (010), then next smallest no N+1 = 3 (011) is not
the right answer as it has TWO 1's.
I guess, for N=2 (010), next smallest
Got AC with your code with small corrections to the output -
don't use getchar();
output specification says: Each line of output should be followed by a
blank line (so, add blank line to match the sample output)
you print a whitespace after each number, so the last character in your line
is a w
i dont knw wt wrong i have done in this simple problem bt its nt being
accepted at uva judge
here is the link to the problem
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=6&page=show_problem&problem=347
please help me debug my code
#include
#include
#include
#inc
here is Working Code Without DP in which we need To Find Out Minimum
Jumps & for every Jumps its Finding Maximum Step That Can Be Cover In
A Jump So that No. of Jumps Required is Minimized..
#include
int main()
{
int arr[]={1 ,3, 5 ,8, 9, 2, 6 ,7 ,6, 8, 9};
int size=sizeof(a)/sizeof(int);
int
@Sunny Good!
--
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
Q1: initially compute xor of all the values from 0 to n in a variable Temp
so temp = 0^1^2^n
let result is used to store the missing number
for each ith bit of missing number where i = 0-31 we can find it as
following
ith bit of result = (xor of all ith bits of values of array) xored with (
thanks very much.
On Sun, Jan 16, 2011 at 5:04 PM, Lakhan Arya wrote:
> @pacific
>
> Sets of size 2 can have 2 elements common with set of size greater
> than 2. for example if set is (1,2) than it is adjacent to sets like
> (1,2,3) (1,2,4), (1,2,3,4...n) etc.
> So (1,2) is adjacent to (1,2,3),
@juver i am really sorry ,i forget to mention.ya this soln will work
only if n is even power of 2.
Regards
Priyaranjan
http://code-forum.blogspot.com
On Jan 17, 12:43 pm, juver++ wrote:
> @awesomeandroid
> Your solution for Q1 is wrong. It can be applied only for such numbers N =
> 2^k, so numb
@above, no :) it is solvable in linear time.
--
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.co
I think Q1 is NP hard problem since the number of bits grows exponentially
as the array size increases.
On Mon, Jan 17, 2011 at 1:13 PM, juver++ wrote:
> @awesomeandroid
> Your solution for Q1 is wrong. It can be applied only for such numbers N =
> 2^k, so number should power of 2.
>
> --
> You
16 matches
Mail list logo