Once upon a time in the evening in one programmer chat, some programmers felt boring. And I don’t remember why, but we started to compare programming languages performance using the Fibonacci algorithm in its recursive implementation. Many times passed since it happened. Only artifacts such as source code left on my hard drive and that’s why I decided to create this post.
The task was to get from a positive integer encoded in the base -2 it’s negative equivalent in the same base. So, to solve this task we need to split it into two parts. In first one we will use a formula to get an integer from its code. And in the second part, we will encode this negative integer back to base -2.
I didn’t know how to name this problem, that’s why I named it as it’s written in the post title. This is a problem from another coding test on one of these coding challenge platforms. I still think that these platforms are just an automation of this weird “whiteboard coding” process. And it’s a pity that companies still believe that such tests could indicate really good programmers. Probably I would write a post with my thoughts on this topic later…
First time I faced this problem during one of my codility tests for a work application. And I failed it. :) Just because I have never heard about such problems before. Anyway, my opinion about codility tests is the same as about writing code on a whiteboard. A programmer should be able to think, to investigate and solve the problem in the end. You can’t train yourself for every existing problem and their endless variations. It’s true especially for whiteboard coding challenge because you have limited time and can’t use online resources. Stress not compliment process of thinking, it destroys this process. Well, it’s a topic for another post. In this post, I will provide my investigation on a Knight distance problem and a solution.
Let me first tell a story how I reached to this issue. I have spent more than 6 hours in sum with a face like this one ‘O_O’ trying to add a very simple feature, which every modern framework have, in my app based on zf3. It’s a flash messenger.
I just wanted to display some fancy messages after actions connected with form submission, like auth or change password.
But they have asked more information. So I have written more text about myself and my skills.
During my application process to x-team I have written a lot about myself. And decided to publish this texts after process was finished.