Search
⌘K

Leetcode 2614. Prime In Diagonal

Given an n×n integer matrix, return the largest prime number that appears on either the main diagonal or the anti-diagonal (or 0 if none). Note: n ≤ 300 and values ≤ 4×10^6, so primality checks must handle numbers up to a few million efficiently.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.