You are given a nums representing a square matrix.
Return the largest prime number that lies on at least one of the diagonals of nums. If no prime number is present on any diagonal, return
Note:
An integer is prime if it is strictly greater than
and cannot be formed by multiplying two smaller positive integers. The diagonals of
numsinclude all elementsnums[i][i]andnums[i][nums.length - i - 1]fornums.length.
Constraints:
nums.length
nums.length nums[i].length
nums[i][j]
You are given a nums representing a square matrix.
Return the largest prime number that lies on at least one of the diagonals of nums. If no prime number is present on any diagonal, return
Note:
An integer is prime if it is strictly greater than
and cannot be formed by multiplying two smaller positive integers. The diagonals of
numsinclude all elementsnums[i][i]andnums[i][nums.length - i - 1]fornums.length.
Constraints:
nums.length
nums.length nums[i].length
nums[i][j]