Deduce row order from logic clues | MathWorks Interview Question