N Queens Problem


Coding for Interviews

In order to up my programming chops, I’ve signed up for this newsletter. It’s been fun, though I don’t typically have the time/energy to answer the questions. Somewhat serendipitously, though, they sent out a question that I’ve poked my nose into recently: the N Queens Puzzle.

My Solution

I’ve taken the approach this newsletter seems to prefer: writing my thinking and solution out by hand. See my write up here.

Critiquing Your Work

As I note in my write up, this isn’t the best solution possible. In fact, my approach is asymptotically just as bad as the naive approach, basically, by Stirling’s Approximation. I was going for shorter code that relied more on the Python standard library, though.