Question is to find 'before' matrix from a given 'after' matrix (Check this for further details).
Also, I did find a very similar problem here at leetcode after that. #1292
Good Luck!