Offline assessment
Time allowed: 20-30mins
A Soduku Puzzle is a logic-based puzzle game that starts with a 9x9 tiled-square - illustrated below.
To play Sudoku the player must use the numbers from 1-9 inclusive and place each number only once
- Within a row left-to-right
- Vertically top to bottom
- Within each 3x3 square
Presented with a pattern of 81 digits, draw the initial Sudoku puzzle board.
- Each row should start with a bar |
- Each row should end with a bar |
- Every three rows should be separated with a row of hyphens
- The header and footer of the puzzle should be closed with a row of hyphens
For example a puzzle may look like this:
The Pattern: 120098357764000000589000000120098357764000000589000000120098357764000000589000000
|- - -|- - -|- - -|
|1 2 0|0 9 8|3 5 7|
|7 6 4|0 0 0|0 0 0|
|5 8 9|0 0 0|0 0 0|
|- - -|- - -|- - -|
|1 2 0|0 9 8|3 5 7|
|7 6 4|0 0 0|0 0 0|
|5 8 9|0 0 0|0 0 0|
|- - -|- - -|- - -|
|1 2 0|0 9 8|3 5 7|
|7 6 4|0 0 0|0 0 0|
|5 8 9|0 0 0|0 0 0|
|- - -|- - -|- - -|
Zeros have been used in the Pattern string to represent a space or non-number. You can use whichever you need.
Note this is for illustrative purposes only. The puzzle will not be solvable with the numbers from this pattern. The objective is just to draw the board. You maybe use this pattern and output as a guide.
This follows the same concept of a FizzBuzz test. I have included a FizzBuzz Test for reference.
Given the numbers 1..N, for every number that is divisible by 3, write "Fizz". For every number divisible by 5, write "Buzz". For any number that is both divisible by 3 and 5, write "FizzBuzz". A number should only have one output.