I have been staffing teams, coaching and interviewing for a long time and at multiple stages of those processes, I have always notices either about myself or my colleagues the application of some old habits.
Most recently a reader of this blog asked my opinion for an upcoming developer interview loop at a major corp. That led me to come up with a post on the subject.
In basic terms, as a developer, you should expect to go through the following cycle of r knowledge.
Warm-Up Question(s)
Data Structures
Analytical Thinking
Algorithms
In 20 years of experience that has been always an observed pattern in hiring a developer. If they don’t then doubt the company that is hiring you to be on the safe side. That usually also translates, and I can only generalize as the job description craft that flows as necessary, with the following practical questions:
Reverse a string, quicksort
Hash table, linked list, a queue of some kind
How much gift wrapping paper is used during holiday time?
Map reduce, cryptography and so on
#1 is used for jump start your brain from the panic phase to get used to the panic room, the whiteboard and your absence of saliva. If you fail that your odds are getting worst big time.
#2 Is a key assessment of your foundations about coding. That includes coding style (camel syntax vs others), ability to explain your own code as you go. Multi-tasking attitude as it is always recommended to describe what you are going to do before you do it. Time is of the essence!
#3 How do you solve problems that seem either too stupid for an interview or that seems to impossible for any conversation between humans?! The goal here is to understand how analytical you are, how many angles you evaluate and how you put your conclusions together and my favorite, in which priority order.
#4 granted that you don’t build an algorithm from scratch every other day however not every nail as an exact hammer, therefore, understand if you are a cookie-cutter man or out of the box thinker is important, when the job description requires that type of talent. Often does not and they do it anyway :-)
I always found that the best way to understand and memorize, not one or the other, that is useless to your career and your future manager, is to figure out a simple project that is fun and at same time forces those two elements to play together and crystalize knowledge in your head.
A game such Tic Tac Toe, at least for this post fits the bill perfectly. There’s always a way to the do something better and in multiple way, what I am going to share with this post is one of them, is generic but is academical vetted. It should serve you well to grasp the concept and most important lead your learning in the context of the lists made above.
We’re going to build a Tic Tac Toe game in C#, Swift and Objective-C from scratch. I will split this goal across multiple posts so I can go in details for each one of those experience.
Let’s play!
The Algorithm
The algorithm is useful for finding both a winning and a blocking move in tic-tac-toe (aka T3).
A T3 board can be represented as a magic square (a recreational math concept) where every cell is represented by a unique integer in the range 1 to 9.
Every row, column, and diagonal sums to 15, and it is not possible to get a sum of 15 from three cells unless they share a row, column or diagonal. With this representation, a potential move is evaluated as a winning move by checking whether it produces a sum of 15 with exactly two other cells occupied by the same player.
A program can check for a block by checking whether the potential move produces a sum of 15 with exactly two other cells occupied by the opposing player.
For each player, two boolean arrays are maintained. TAKEN and PAIRS.
Array taken keeps track of those cells occupied by each player. The number of vector in the array is 9. Each array element is initializedtofalse. When a player makes a move the array element corresponding to a cell that matches the same spot/number on the board is set to true.
Array pairs keep track of two-in-a-row combinations for the player. This information is represented by recording all sums consisting of two cells occupied by the player.
This array needs to be indexed from 3 to 17 (two steps ahead) and with each element initialized to false. When a player makes a move, all resulting sums are recorded in the player’s pairs array, as in:
for (int k=1, k<=9; k++) if (taken[k]) pairs[move + k] = true;
Many of the recorded pairs do not share the same row, column or diagonal (such as 8 and 9). Recording this information does not hurt our solution and is more efficient than incurring the overhead of testing each pair for collinearity.
In the next post, we’re going to implement the algorithm in one of the mentioned languages and platforms. In the meanwhile don’t forget to resume from your video library what actually really brought me to think about this game!!
I own a few Synology NAS, one of them is dedicated to development for various projects. More than once I need to store data into a relational database. Synology comes with MySQL Administration tool (MyPhpAdmin) and the cool MariaDB. It actually also comes under the hood with Postgres. By default, it’s not configured for your consumption. Below you find my recipe on how to get it up and running. If you are not familiar with vi (the editor) then you definitely want to install a package manager (iPKG) that allows you to install what you give for granted on my UNIX OSes. Say nano as for the editor. To do that the best guide ever that I found is already written by @zarino – follow his instructions and you can’t get it wrong. There’s only one piece of information that is missing from that blog post and is for a special case: When you log back into the system the profile that enables all the goodies of the packaging isn’t loaded by default, you can force the loading doing source /
TLDR : I am decluttering my life. On my own terms. If your span of attention is higher than one sentence, read on and you will see how I got to create my own word "Zeninifcation" as a start to take action against the fact that I have more crap than I need and it is sucking my time just to keep it out of the sight. I don't like clutter. I don't do things I don't like. Even if my wife disagrees, no, I don't have OCD according to this one random article . But I do consider clutter a distraction to my thinking. It's like if you always dress like a slob then that one day you have to dress nicely it feels specially constraining. Or if you normally dress like a New Yorker stock exchange assassin the few days in a row that you are in your PJ feels like after you finished your huge McDonald's burger the first week after you started a diet. Let's dig deeper. I moved from Europe to the U.S.A. about 18 years ago, by the time of this post. At first, as most
Boxee If you haven't met this beauty when it came out then you have been missing out! It was so forward-thinking and so well designed. As often happens to great acquired products, they are killed for reasons beyond the compressible path to the mere mortals. I was helping my friend Cristiano in setting up his Synology system along with Plex. And every single time I dealt with Plex I regretted every second of just installing and then figuring out how to remove that cancer from the system. I know that some people out there must have a good experience about that product otherwise I don't understand how they still alive... but over many years that hasn't been me and now Cristiano too :-) So I was digging in my garage for something that I could have used as tvbox with some Linux distro on it. And that's when I ran in this wonderful piece of tech. Sitting there without love and full of dust bunnies. It booted at the first attempt and the remote battery was still alive!! Sadly,
Comments
Post a Comment