This episode will be a little different.
This video will teach you how to approach an algorithm-based, Google-style interview question in Scala with pure functional programming.
N-Queens is a classical computer science problem, where you need to find where you should place N chess queens on an NxN chess board, such that no two queens can attack each other. The problem asks for all valid possibilities. Depending on how big N is, there may be a lot.
This problem is usually solved with either backtracking in imperative code, or stack-based recursion. In this video, I show you a step-by-step algorithm in Scala, expressed as a purely functional program based on tail recursion.
This episode is a bit different because it’s a direct extract from the Scala & Functional Programming Interview Practice course, where — in its current March 2021 form — we deconstruct 50+ algorithm-based interview questions on various difficulty levels, in purely functional Scala. To my current knowledge, this is the only course on “cracking the coding interview” specifically for Scala programmers.