ESPR17E - EDITORIAL

PROBLEM LINKS :

Practice

Author : saif_husain

DIFFICULTY :

Easy

PREREQUISITES :

arrays

PROBLEM :

Given the matrix of size 3 x 3 containing integer numbers where each number N is from 1 to 9 only. In given matrix total M numbers are missing and are denoted by ’ ? ’ symbol. Your task is to fill the missing places from top to bottom and left to right manner in increasing order. Note that no number should be repeated in matrix.

EXPLAINATION :

For filling up missing places ( ? ) we required remaining numbers from 1 to 9.

To keep the track of used and available numbers we can simply use boolean array

For the sake of example,
a[10]=| 1 | 1 | 1 | 0 | 0 | 0 | 1 | 1 | 1 |

where 1 represents the ith placed number is used and 0 represents the ith placed number is available.

After scanning data and updating the array a we can simply use 2 for loops to obtain required output.

SOLUTION :

link to solution