Done: isSolved function