← All problemsSign in

2614. Prime In Diagonal

LeetCodeArrayMathMatrixNumber TheoryOpen on judge ↗

You are given a 0-indexed two-dimensional integer array nums. Return the largest prime number that lies on at least one of the diagonals of nums. In case, no prime is present on any of the diagonals, return 0. Note that: - An integer is prime if it is greater than 1 and has no positive integer divisors other than 1 and itself. - An integer val is on one of the diagonals of nums if there exists

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start