Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fundamental coding help
#7
Fiel Wrote:In this problem, there are four possible pairings which would cause exceptions. Either the first and second number, second and third, or third and first are alike. Each of the following if statements checks if the others are pairs.
 Spoiler

I'm sure there must be a faster way to do this as well because b^a is the same as a^b.

I see no reason as of why you need to xor first, then compare with >. This works perfectly fine, does the same thing and requires less computing power:

 Spoiler
Faster approach is probably
 Spoiler

For four, split it up more. You know you use repetitive patterns (diffAB <= 1), for example. Also, (! (diffAB <= 1)) == (diffAB >= 2).
 Spoiler

Kalovale Wrote:Okay this is getting pretty petty of me, but I keep getting the impression that my approach isn't proper enough. It just seems somehow messy.

 Spoiler

As of right now, fixTeen returns n if n is 13, 14, 17, 18 or 19. Otherwise, what does it return? What should it return?
Reply


Messages In This Thread
Fundamental coding help - by Kalovale - 2010-10-28, 04:38 AM
Fundamental coding help - by Fiel - 2010-10-28, 08:24 AM
Fundamental coding help - by Kalovale - 2010-10-28, 10:07 AM
Fundamental coding help - by Eos - 2010-10-28, 10:22 AM
Fundamental coding help - by Fiel - 2010-10-28, 10:38 AM
Fundamental coding help - by Kalovale - 2010-10-28, 12:16 PM
Fundamental coding help - by Nikkey - 2010-10-28, 12:49 PM
Fundamental coding help - by Kalovale - 2010-10-28, 12:59 PM
Fundamental coding help - by Nikkey - 2010-10-28, 01:06 PM
Fundamental coding help - by Kalovale - 2010-10-28, 01:09 PM
Fundamental coding help - by XTOTHEL - 2010-10-28, 02:47 PM
Fundamental coding help - by Nikkey - 2010-10-28, 03:06 PM
Fundamental coding help - by Dusk - 2010-10-28, 03:17 PM
Fundamental coding help - by Stereo - 2010-10-28, 03:45 PM
Fundamental coding help - by Kalovale - 2010-10-29, 10:50 AM
Fundamental coding help - by Spaz - 2010-10-29, 02:41 PM
Fundamental coding help - by Fiel - 2010-10-29, 04:07 PM
Fundamental coding help - by Stereo - 2010-10-30, 09:46 AM
Fundamental coding help - by Russt - 2010-10-30, 10:34 AM
Fundamental coding help - by Kalovale - 2010-11-03, 12:50 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)