Menu
Question Index
...


Write a program to find the allowed numbers in the given 2x3 sudoku. The empty positions are marked as 0.

Input (int[][], SudokuPosition) Output (List)
0 0 2 4 0 0
0 0 0 0 0 6
0 3 0 0 0 5
2 0 0 0 4 0
4 0 0 0 0 0
0 0 1 6 0 0
SudokuPosition is [2, 4]
[1, 2, 3, 5]
0 1 3 0 0 0
0 0 2 0 0 0
3 4 0 1 0 0
0 0 1 0 3 5
0 0 0 3 0 0
0 0 0 2 6 0
SudokuPosition is [1, 5]
[2, 4, 5]

class FindAllowedNumbersIn2x3Sudoku

{    public static void main(String s[])
    {
        int[][] sudoku = {{1, 0, 2, 4, 0, 0}, {0, 0, 0, 0, 0, 6}, {0, 3, 0, 0, 0, 5}, {2, 0, 0, 0, 4, 0}, {4, 0, 0, 0, 0, 0}, {0, 0, 1, 6, 0, 0}};
        System.out.println("The numbers that can be placed at [5, 5] are : " + getAllowedNumbersAtGivenPosition(sudoku, new SudokuPosition(5, 5)));

    }


public static List<Integer> getAllowedNumbersAtGivenPosition(int[][] sudoku, SudokuPosition sudokuPosition) {
//Write code here to find the allowed numbers in the given sudoku.
}
}
class SudokuPosition {

int rowPosition;
int columnPosition;

public SudokuPosition(int rowPosition, int columnPosition) {
this.rowPosition = rowPosition;
this.columnPosition = columnPosition;
}

public int getRowPosition() {
return rowPosition;
}

public int getColumnPosition() {
return columnPosition;
}
}

Doubts

Problems

Topic: Java ArrayList

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App