A new puzzle

The folks across the road Telogis are hiring, and they have a puzzle/quiz on their web site.

I’ve my solutions don’t seem correct… and I’m not sure of the language the code is written in.

Some assumptions that may effect the result:

  • the number precession and overflow behaviour
  • the empty array set indexing behaviour
  • how non-consecutive array elements are printed

That is if how I’ve simplified the code down is correct.

Interesting C# aside: the C# compiler does not parse octal formatted numbers, so 12345 and 0x3039 do not equal 030071, quite a strange diversion from C and C++.



Harv 2008-12-06 19:03:40

I’ve solved it! But I’m struggling to answer the question on the resultant webpage. The answer depends on whether the question is asked from a human readability perspective, or from a processing speed perspective.

Harv 2008-12-06 19:24:09

It also depends on if the question is directly related to the supplied algorithm, or whether it is a general case. You’ll see what I mean when you solve the puzzle!!

Simeon 2008-12-06 22:34:47

Oh just great… I’m now never going to hear the end of this….

Not even sure who I hate more, Telogis for having a puzzle, me for blogging about it, or you for solving it.

And no I do not want any clues.

Simeon 2008-12-07 09:30:12

Ok, I solved it by leaving the algorithm along, and just making it compile, so now I will be able to check my re-write to find the mistake.

Simeon 2008-12-07 09:55:44

I see your point, then if I was to answer, I would cover both those point. In answer to your seconds posts question, I’d assume in puzzle situation, but you could describe it in general context.

Alex Henderson 2008-12-07 18:04:30

[Edit: Cut out Alex’s perfect answer to the puzzle, and follow-up task, because it’s only the right thing to-do, and he said I could]

Feel free to delete/censor this comment later on ;o) probably don’t wont to give away the details to potential candidates…