GUVI
Back

Matrix Question 2: Wrong Sample Output in the Question Description

Created 2 years ago
35 Views
2 Comments
SenthilKumarwbd4ze
@SenthilKumarwbd4ze
SenthilKumarwbd4ze
@SenthilKumarwbd4zeProfile is locked. Login

In the following question,

The Sample Output is supposed to be NO, instead it is mentioned as 'YES'.

Mr. Prime is a coder who loves solving problems which involve the mention of the word ‘prime’. He recently came across a puzzle in which he had to find sum of elements which are located at positions whose row+column index value is a prime number. After finding the sum, he had to check whether the sum obtained is a prime number or not. Assume that you are Mr. Prime and are given a matrix of arbitrary dimensions. Check whether the sum of elements located at prime indices is a prime number.

 

Input Description:
Dimensions of the matrix followed by the elements of the matrix

Output Description:
YES/NO

Sample Input :
3 3
1 2 3
4 5 6
7 8 9
Sample Output :
YES

Comments (2)
Please login to comment.
 
Powered by habitate.io Habitate