Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
No initial flattening solution in Clear category for 15-puzzle Solvability by StefanPochmann
from bisect import insort
def fifteen_puzzle(position: list[list[int]]) -> bool:
p = []
s = 0
for i, r in enumerate(position):
for x in r:
insort(p, x)
s += i if x == 16 else p.index(x)
return not s % 2
March 25, 2023
Comments: