This is a specific example of an Exact cover problem: https://en.wikipedia.org/wiki/Exact_cover
If you haven't seen Knuth's Dancing Links implementation of Algorithm X, I highly recommend it. It's based on the observation that updating a doubly-linked list in-place preserves enough information to make backtracking easy.