SWAPPING (HARD)
+6
ish_mnnit
ankurgutpa
Admin
amazon
mnnit.rahul
SwitchCase
10 posters
Page 1 of 1
SWAPPING (HARD)
NOW Ur task is still the same..
Except....
U r allowed only 3 statements..
And only one operator.
(PS: DONT BE SMART AND USE -(-b) as the same thing!!!!)
Except....
U r allowed only 3 statements..
And only one operator.
(PS: DONT BE SMART AND USE -(-b) as the same thing!!!!)
SwitchCase- Posts : 5
Join date : 2008-08-13
Re: SWAPPING (HARD)
coooooooooool raaaaahhhhuuuuuulllllllllll
oo spam abuse!!!!
oo spam abuse!!!!
amazon- Posts : 13
Join date : 2008-08-10
Re: SWAPPING (HARD)
rahul soltuion was cool but u know the above solution fails at a prticular test case ..............
find it out ?
find it out ?
Re: SWAPPING (HARD)
well i think solution is correct
i 've tried for all test cases
+ +
+ -
+ 0
- 0
- -
it's working fine
i 've tried for all test cases
+ +
+ -
+ 0
- 0
- -
it's working fine
ankurgutpa- Posts : 44
Join date : 2008-08-10
Age : 36
Location : Tandon 72
Re: SWAPPING (HARD)
rahul solution can also be written as--
a^=b^=a^=b
i think it shud also work
a^=b^=a^=b
i think it shud also work
ish_mnnit- Posts : 4
Join date : 2008-08-10
Re: SWAPPING (HARD)
bhagalpur sir
ab aap hi bata dejie ki kis case me a^b wala soln fail ho rha hai???
ab aap hi bata dejie ki kis case me a^b wala soln fail ho rha hai???
sweetesh singh- Posts : 8
Join date : 2008-08-12
Re: SWAPPING (HARD)
xor(^) operator will fail when you will have carry in your addition..
gunendu- Posts : 2
Join date : 2008-09-24
Re: SWAPPING (HARD)
.......above method will fail when both variables are equal becase in that case xor operation will give zero.
vikas- Posts : 2
Join date : 2008-09-23
Re: SWAPPING (HARD)
@amit
also for characters
also for characters
ankurgutpa- Posts : 44
Join date : 2008-08-10
Age : 36
Location : Tandon 72
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum