Skip to main content Link Menu Expand (external link) Document Search Copy Copied

CS162 - Lab 08 Solutions

TABLE OF CONTENTS

Lab 08 - Advanced Recursion

3.1 - N Queens

  • Input: $N$: a chessboard with size $N \times N$.
  • Output: location $(i, j)$ of $N$ queens in that chessboard. Only $1$ solution is required.
  • Solution: https://ideone.com/4W5zDO

3.2 - N Queens

  • Input: $N$: a chessboard with size $N \times N$.
  • Output: location $(i, j)$ of $N$ queens in that chessboard. Print all solutions.
  • Solution: https://ideone.com/zzlxeL

Bonus - N Queens - LeetCode

3.3 - Knight Tour

  • Input: $N$: a chessboard with size $N \times N$.
  • Output: the movement orders of the knight ($1$ to $N \times N$) in that chessboard. Only $1$ solution is required.
  • Solution: Naot

3.4 - Knight Tour

  • Input: $N$: a chessboard with size $N \times N$, a start cell (istart, jstart) and an end cell (iend, jend).
  • Output: the movement orders of the knight ($1$ to $N \times N$) in that chessboard. Only $1$ solution is required.
  • Solution: Naot

3.5 - Tribonacci - LeetCode

3.7 - Permutation of an array - LeetCode

3.8 - Permutation of an array without duplicates - LeetCode

3.9 - Next permutation - LeetCode

3.10 - Permutation of a string

3.12 - Letter Case Permutation - LeetCode