<story><title>Inverse Fizzbuzz</title><url>http://www.jasq.org/2/post/2012/05/inverse-fizzbuzz.html</url><text></text></story><parent_chain></parent_chain><comment><author>harpastum</author><text>&lt;i&gt;TLDR: Here&apos;s a constant-time solution: &lt;a href=&quot;http://codepad.org/Id9eu0Ax&quot; rel=&quot;nofollow&quot;&gt;http://codepad.org/Id9eu0Ax&lt;/a&gt; &lt;/i&gt;&lt;p&gt;Matching the the sequence of fizz/buzz/fizbuzz disregarding numbers is a repetitive case.&lt;p&gt;Start with&lt;p&gt;&lt;pre&gt;&lt;code&gt;    3 Fizz
    5 Buzz
    6 Fizz
    9 Fizz
    10 Buzz
    12 Fizz
    15 FizzBuzz

    18 Fizz
    20 Buzz
    21 Fizz
    24 Fizz
    25 Buzz
    27 Fizz
    30 FizzBuzz
    
    [repeats]
&lt;/code&gt;&lt;/pre&gt;
Just split the input list as a prefix of a few, and then a repeat.  The goal of the shortest total distance between them is constant. You just need to measure the number of ints between each of the 8 repeating distances.&lt;p&gt;For example:&lt;p&gt;&lt;pre&gt;&lt;code&gt;     3 -&amp;#62;  Fizz
    +2 -&amp;#62;  Buzz
    +1 -&amp;#62;  Fizz
    +3 -&amp;#62;  Fizz
    +1 -&amp;#62;  Buzz
    +2 -&amp;#62;  Fizz
    +3 -&amp;#62;  FizzBuzz

    +3 -&amp;#62;  Fizz
    +2 -&amp;#62;  Buzz
    +1 -&amp;#62;  Fizz
    +3 -&amp;#62;  Fizz
    +1 -&amp;#62;  Buzz
    +2 -&amp;#62;  Fizz
    +3 -&amp;#62;  FizzBuzz

&lt;/code&gt;&lt;/pre&gt;
So you would match against the list [Fizz, Buzz, Fizz, Fizz, Buzz, Fizz, FizzBuzz].</text></comment>
<story><title>Inverse Fizzbuzz</title><url>http://www.jasq.org/2/post/2012/05/inverse-fizzbuzz.html</url><text></text></story><parent_chain></parent_chain><comment><author>EternalFury</author><text>Cute.
Now, back to reality, where 99% of the code is dead simple stuff that sticks around for years.
I am really starting to believe it is a fault to be too clever in software development. Granted, the easier your code is to understand, the better it is for business.</text></comment>