That's the issue with toy examples like mine and the ones in the article. If it's a common pattern there's a pretty good chance that you can do it in a simple, optimized and readable way. And then the ...
Some results have been hidden because they may be inaccessible to you
Show inaccessible results