From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

fizbuzz - a simple coding challenge

Woo! i can Smiley Happy again!

 

I quite enjoyed this little challenge (compared to some of the mountains I have to climb at work!)  perhaps this could be a regular feature?

 

I'm sure it'd improve my coding (and others) to see some different approaches to problems. 

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 11 of 41
(9,855 Views)

Why does everybody use so much duplicate code for the two Q&R operations. Simply divide by an array of [3,5]! Only one Q&R needed. 😮

 

Case structures are for wimps, so here's a solution that does not hide any code. 😄

 

 

Spoiler
Message 12 of 41
(9,852 Views)

A slightly better version of my first attempt then:

 

Spoiler
Fizzbuzz#2.JPG

 

-CC

 

p.s. what do case structures have to do with Dark Matter? (Wimps) Smiley Wink

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


Message 13 of 41
(9,823 Views)

@altenbach wrote:

Why does everybody use so much duplicate code for the two Q&R operations. Simply divide by an array of [3,5]! Only one Q&R needed. 😮

 

Case structures are for wimps, so here's a solution that does not hide any code. 😄

 

 


 

I like these small challenges, learned about the  Q&R with array 🙂 

however the string conversion and replace array approach is executing worthless in 7/15*100 %

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 14 of 41
(9,811 Views)

@Henrik Volkers wrote:
however the string conversion and replace array approach is executing worthless in 7/15*100 % 

If the problem had been to do it for all possible I32 integers and as fast as possible, I probably would have coded it quite differently. You need to find the right balance.

This is sufficient for the current problem. 😄

Message 15 of 41
(9,807 Views)

@jcarmody wrote:

@Henrik Volkers wrote:

I haven't tested it for speed, however I wanted to avoid two quotient&remainder vis 


I was referring to your first solution.


 

Closer to a TTL logic 😉 using shift registers instead of Q&R (Hey, I started soldering before programming 😉  and still miss the triode.vi 😄 ) , where is the obfuscation? 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 16 of 41
(9,803 Views)

@P Anand wrote:

@Even Deejay wrote:

A nice task I hope I solved without any Rube Goldberg codeSmiley Happy

 

FizzBuzz.png 


Still small thing you have that kind. You could have used Equal2Zero.png instead of Equal2Zero - 1.png. Smiley Wink


 

I enjoy reading these type so threads as well.

 

In my minds eye, I would prefer to find Even's approach with P Anand's mods. It is obvious "at a glance" what the code does. The other approaches are like trying to read one of my "quicky-replies". Yes there maybe an asnwer in there but you hvae to think to figure it out.

 

Thanks for the entertainment!

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 17 of 41
(9,739 Views)

Thank you very much Ben for this kind of reply to my thread. Smiley Happy

-----

The best solution is the one you find it by yourself
0 Kudos
Message 18 of 41
(9,737 Views)

here is my variation

 

puzzle.png

Regards
Ray Farmer
Message 19 of 41
(9,681 Views)

Since the interview was joined by marketing and the project leader, the optics was switched to silver and more features had to be included.

Who needed the progress bar (followed by a slow down to make it visible!)  couldn't be reconstructed by the protocol 😉

FFFF.pngFFFF-BD.png

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 20 of 41
(9,660 Views)