After buying a new laptop, I spent a lot of time with the Internet problem on Ubuntu. And I did manage to solve the problem. There were frequent connection breaks and the internet speed was very slow. At first, I was thinking about buying a new router, but at the same time under Windows 8 everything worked with a bang.
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.