https://happydevops.com/2022/06/09/hackerrank-flipping-the-matrix-en-scala/