03-06-2012 08:59 AM
Woo! i can 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.
03-06-2012 09:02 AM - edited 03-06-2012 09:34 AM
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. 😄
03-06-2012 10:04 AM - edited 03-06-2012 10:05 AM
A slightly better version of my first attempt then:
-CC
p.s. what do case structures have to do with Dark Matter? (Wimps)
03-06-2012 10:34 AM
@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 %
03-06-2012 10:40 AM
@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. 😄
03-06-2012 10:46 AM
@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?
03-07-2012 07:41 AM
@P Anand wrote:
@Even Deejay wrote:
A nice task I hope I solved without any Rube Goldberg code
![]()
Still small thing you have that kind. You could have used
instead of
.
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
03-07-2012 07:47 AM
Thank you very much Ben for this kind of reply to my thread.
03-08-2012 07:56 AM
here is my variation
03-08-2012 10:56 AM - edited 03-08-2012 11:02 AM
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 😉