,
Neeldhara Misra
Creative Commons Attribution 4.0 International license
We study a family of sorting match puzzles on grids, which we call permutation match puzzles. In this puzzle, each row and column of a n × n grid is labeled with an ordering constraint - ascending (A) or descending (D) - and the goal is to fill the grid with the numbers 1 through n² such that each row and column respects its constraint. We provide a complete characterization of solvable puzzles: a puzzle admits a solution if and only if its associated constraint graph is acyclic, which translates to a simple "at most one switch" condition on the A/D labels. When solutions exist, we show that their count is given by a hook length formula. For unsolvable puzzles, we present an O(n) algorithm to compute the minimum number of label flips required to reach a solvable configuration. Finally, we consider a generalization where rows and columns may specify arbitrary permutations rather than simple orderings, and establish that finding minimal repairs in this setting is NP-complete by a reduction from feedback arc set.
@InProceedings{gajjar_et_al:LIPIcs.FUN.2026.20,
author = {Gajjar, Kshitij and Misra, Neeldhara},
title = {{Permutation Match Puzzles: How Young Tanvi Learned About Computational Complexity}},
booktitle = {13th International Conference on Fun with Algorithms (FUN 2026)},
pages = {20:1--20:16},
series = {Leibniz International Proceedings in Informatics (LIPIcs)},
ISBN = {978-3-95977-417-8},
ISSN = {1868-8969},
year = {2026},
volume = {366},
editor = {Iacono, John},
publisher = {Schloss Dagstuhl -- Leibniz-Zentrum f{\"u}r Informatik},
address = {Dagstuhl, Germany},
URL = {https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.FUN.2026.20},
URN = {urn:nbn:de:0030-drops-257398},
doi = {10.4230/LIPIcs.FUN.2026.20},
annote = {Keywords: sorting match puzzles, permutation match puzzles, grid puzzles, constraint satisfaction, directed acyclic graphs, hook length formula, standard Young tableaux, NP-completeness, feedback arc set}
}