Just solved one of my favorite kinds of problems – the one that looks obscenely complicated but has a deceptively simple solution.