I decided to use an exercise I use with candidates for a Scala position as a starting point for discussion. It consists in modelling a binary tree and writing a function that acts on it.
First I ask the candidate to model a binary tree, similar to the one the figure below:
And then we work together on how to write a function that adds a unique identifier to all nodes of the tree, like in the following example. …