Groups | Search | Server Info | Login | Register


Groups > comp.os.linux.misc > #77412

Re: Simple Programming Challenge

From John McCue <jmclnx@gmail.com.invalid>
Newsgroups comp.os.linux.misc
Subject Re: Simple Programming Challenge
Date 2025-11-12 17:22 +0000
Organization A noiseless patient Spider
Message-ID <10f2fo5$1fj9e$1@dont-email.me> (permalink)
References <18774b74533f13ac$14097$3668313$802601b3@news.usenetexpress.com>

Show all headers | View raw


In comp.os.linux.misc Joe Fantastic <jf@linux.rocks> wrote:
> Programming challenge.
> 
> Write a FAST implementation of the "Fizzbuzz" game:
> 
> <https://en.wikipedia.org/wiki/Fizz_buzz>
> 
> When I say "FAST" I mean fast both in terms of speed and efficiency.
> 
> There should be no upper limit on the largest integer processed
> (within hardware limitations), but we'll cap it at 1000 here.
> 
> Seems trivial, eh?
> 
> This is an interview question that I give to my applicants and no one
> has passed yet.

Kind of a silly thing, but I find it hard to believe no one
passed this, unless you are looking for a real specific
logic.  People could spend weeks on optimizations, but in
today's business environment, get it done fast is the mantra
and worry about speed later on if it becomes a problem.
Saving a micro second or 2 may not be worth the effort.

So, in the old days on UN*X, the preferred method was to use
shell scripts instead of c.  I went really old school :)

#!/bin/csh -f
set i = 1
while ($i < 1001)
    set fizz = ' '
    set buzz = ' '
    if ($i % 3 == 0) then
        set fizz = "Fizz"
    endif
    if ($i % 5 == 0) then
        set buzz = "Buzz"
    endif
    echo $i $fizz$buzz
    @ i++
end

-- 
[t]csh(1) - "An elegant shell, for a more... civilized age."
                        - Paraphrasing Star Wars

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Simple Programming Challenge Joe Fantastic <jf@linux.rocks> - 2025-11-12 15:19 +0000
  Re: Simple Programming Challenge "Joel W. Crump" <joelcrump@gmail.com> - 2025-11-12 10:31 -0500
    Re: Simple Programming Challenge John Ames <commodorejohn@gmail.com> - 2025-11-12 08:07 -0800
    Re: Simple Programming Challenge ram@zedat.fu-berlin.de (Stefan Ram) - 2025-11-12 16:18 +0000
      Re: Simple Programming Challenge Joe Fantastic <jf@linux.rocks> - 2025-11-12 16:41 +0000
        Re: Simple Programming Challenge Pancho <Pancho.Jones@protonmail.com> - 2025-11-12 17:29 +0000
          Re: Simple Programming Challenge Pancho <Pancho.Jones@protonmail.com> - 2025-11-12 17:33 +0000
            Re: Simple Programming Challenge Richard Kettlewell <invalid@invalid.invalid> - 2025-11-13 00:00 +0000
              Re: Simple Programming Challenge Pancho <Pancho.Jones@protonmail.com> - 2025-11-13 10:45 +0000
        Re: Simple Programming Challenge Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-12 23:30 +0000
        Re: Simple Programming Challenge ram@zedat.fu-berlin.de (Stefan Ram) - 2025-11-13 13:24 +0000
          Re: Simple Programming Challenge Ralf Fassel <ralfixx@gmx.de> - 2025-11-13 16:16 +0100
      Re: Simple Programming Challenge Fritz Wuehler <fritz@spamexpire-202511.rodent.frell.theremailer.net> - 2025-11-12 18:37 +0100
    Re: Simple Programming Challenge Brock McNuggets <brock.mcnuggets@gmail.com> - 2025-11-12 20:05 +0000
      Re: Simple Programming Challenge "Joel W. Crump" <joelcrump@gmail.com> - 2025-11-12 15:30 -0500
        Re: Simple Programming Challenge Brock McNuggets <brock.mcnuggets@gmail.com> - 2025-11-12 20:50 +0000
  Re: Simple Programming Challenge John McCue <jmclnx@gmail.com.invalid> - 2025-11-12 17:22 +0000
    Re: Simple Programming Challenge c186282 <c186282@nnada.net> - 2025-11-12 23:57 -0500
  Re: Simple Programming Challenge Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-12 23:24 +0000

csiph-web