Jimmy Theis

DEC 1, 2013

Programming Interview Question: Eight Queens

This week's Coding for Interviews question is the Eight Queens Puzzle, where the challenge is to find all the ways to place 8 queens on an 8x8 chess board, such that none of them are in a position to kill each other in the next move. You can see how tricky this can be if you try to do it by hand (unless you're Emilie, who found a solution in just a few minutes).

Here's my CoffeeScript solution. It's a depth-first search of board states (placing a queen in the next available position in the next unoccupied row for each new state), and it returns an array of "solutions". Each solution is an array of indices representing the column in each row where a queen is to be placed (so [1, 3] represents queens at (row 0, column 1) and (row 1, column 3)):

Read more

NOV 11, 2013

Programming Interview Question: Level-Order Traversal

I've been subscribed to Brian Jordan's Coding for Interviews weekly emails (which I highly recommend) for a while now, but I've never written up an official solution to any of the weekly questions.

In the meantime, I've become interested in learning more about CoffeeScript (a language that transcompiles to JavaScript), but have never found the time to sit down and really learn about it. So, in an effort to kill two birds with one stone, I'm using CoffeeScript to solve last Friday's interview question:

Read more

NOV 3, 2013

Blog Relaunch

Well, it's been a while (7 months or so) since I've posted anything. In the meantime, I've been pretty busy. My work fills up a lot of my time, and I've really enjoyed what I've been working on for the past few months, so I let that be my primary focus. As the seasons change, though, I realize that I've missed writing blog posts (even if nobody reads them). So, I'm taking up blogging again.

Read more

MAR 24, 2013

A Follow-Up on Energy Savings

A couple of months ago, I posted about a few of measures I had taken to try to reduce the utility costs in my apartment. Now that it's been a few months, I think I owe a report (even if it's sort of an inconclusive one).

I started the power-saving measures around January 10, 2013. Since then, I have received my power bills for 12/23 - 1/21 (29 days) and 1/21 - 2/21 (31 days). The first covers 1095 degree days, and the second 1092. This is a surprisingly close comparison (better than I thought I'd get) between two months, even though one month contained the end of a holiday season and the other one is a little longer.

Read more

FEB 17, 2013

Using Dropbox as a Private GitHub

This may be old news by now, but I only just realized how great it is, so consider this my rebroadcasting of the idea:

GitHub has now become the preferred way to manage source code for programming projects. There's good reason for this: it's a really wonderful site with a great following. However, there are times when it's really not desirable to have a project completely public. GitHub provides some paid options for this, as well as educational accounts (which you should really check out if you're a student or instructor). If you've used up your free repositories or simply don't think the project at hand warrants spending money on, you need another option.

Read more