Week 8 Programming Assignment 1
Due on 2021-03-18, 23:59 IST
Zero-One Matrix
Given a matrix with M rows and N columns, you are required to check if the matrix is a Zero-One Matrix. A Zero-One or a Binary matrix is a matrix in which all the elements are either 0 or 1.
Given a matrix with M rows and N columns, you are required to check if the matrix is a Zero-One Matrix. A Zero-One or a Binary matrix is a matrix in which all the elements are either 0 or 1.
Input Format
The first line of the input contains two space separated integers M and N which represents the number of rows and the number of columns respectively.
Next M lines represent the elements in M rows with each line containing N space separated integers.
Output Format
Print Yes or No
Example:
Input:
3 3
1 0 0
0 1 0
0 0 1
3 3
1 0 0
0 1 0
0 0 1
Output:
Yes
Yes
Input:
2 2
1 2
0 1
Output
No
No
Explanation
In the first case, all the elements of the matrix are 0 and 1. In the second case element at the first row and second column is 2
Week 8 Programming Assignment 2
Due on 2021-03-18, 23:59 IST
Symmetric Matrix
Given a N X N square matrix, determine if it is a Symmetric Matrix.
Input Format
The first line of the input an integer N which represents the number of rows and the number of columns.
Next N lines represent the elements of the matrix.
Output Format
Print Yes or No
Example:
Input:
3
1 -2 3
-2 3 1
3 1 2
3
1 -2 3
-2 3 1
3 1 2
Output:
Yes
Yes
Week 8 Programming Assignment 3
Due on 2021-03-18, 23:59 IST
Print Matrix
Given an integer N, print a N X N square matrix, consisting of numbers from 1 to N^2, in the row-wise order
Input Format
The first line of the input an integer N
Output Format
Output Format
Print N lines having numbers from 1 to N^2
Example:
Input:
3
3
Output:
1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9