In my last post, I described the first Schindler Milan office weekly riddle. It has been a big success, and it had a brilliant winning solution (one of mine 🙂 ). A simple problem, implementing increment by one without using addition, yet open enough to trigger a good number of solutions.
As the winner, it was my duty to invent the next riddle. A really daunting task if I wanted to live up to the expectations. Honestly, I didn’t invent anything, I just squeeze the web looking for a good programming riddle in the drops.
Eventually, I decided to go for determining the lowest of two numbers… using if-less programming. After all, if statement can be tricky and someone already pointed out that if statement should be considered harmful in the same way the infamous goto is.
Continue reading “What if “if” would go missing?”
Do you remember the good old point-and-click adventures? They provided plenty of puzzles and riddles with a compelling narrative. I loved them, possibly because I love riddles, puzzles, and this sort of challenge. So I was super excited when my employer supported the initiative of a Coding-Riddle-of-the-Week contest. This is the second issue and I’m going to present it here.
Produce a program which increments an integer variable by a value of 1 without using sum or increment operators.
You are pretty free to choose whatever integer size and type you prefer (I would say, but
bool), and whatever language you want. I stuck with C++ because it was quicker, but most of my solutions can be easily ported to other languages.
So, before continuing be sure to give some thought to this riddle to not spoil the fun.
Continue reading “Mom! My plus key is broken!”