$10K coding deathmatch
Jacob Fugal
lukfugl at gmail.com
Fri Nov 3 16:58:10 MST 2006
On 11/3/06, Derek <derek at burdick.cc> wrote:
> Just out of curiosity, which of the following lines match?
> 0
> 1
> 1000000
>From the problem statement:
"The definition implies that any sequence of a single integer is a match."
Why? Because anything that does not *fail* passes. By the problem definition:
"We are looking for sequences of n > 0 integers where the absolute values
of the differences of successive elements are included in the set of
numbers 1 through n - 1."
So a sequence only fails when:
* n == 0 (n < 0 doesn't make much sense)
* a pair of elements have a delta outside [1, n)
Since 1 != 0 and there are not pairs of elements with a delta outside
[1, n), the sequence is a match.
Jacob Fugal
More information about the PLUG
mailing list