2614. Prime In Diagonal

  Рет қаралды 27

CodeVia

CodeVia

Күн бұрын

2614. Prime In Diagonal #leetcodequestionandanswers #java #coding #2darray #primenumber #arraylist #hashset #leetcodequestionandanswers #java #coding #microsoftinterview #javainterviewquestions #interview #amazoninterviewpreparation #googleinterview #leetcode #javaprogramming
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 an integer i for which nums[i][i] = val or an i for which nums[i][nums.length - i - 1] = val.
In the above diagram, one diagonal is [1,5,9] and another diagonal is [3,5,7].
Example 1:
Input: nums = [[1,2,3],[5,6,7],[9,10,11]]
Output: 11
Explanation: The numbers 1, 3, 6, 9, and 11 are the only numbers present on at least one of the diagonals. Since 11 is the largest prime, we return 11.

Пікірлер: 1
@bsrayat8200
@bsrayat8200 10 ай бұрын
Great!
MUST KNOW junior role JAVA interview questions
42:15
Keep On Coding
Рет қаралды 122 М.
yes, !! is also a math symbol
16:06
Wrath of Math
Рет қаралды 22 М.
Help Me Celebrate! 😍🙏
00:35
Alan Chikin Chow
Рет қаралды 86 МЛН
Synyptas 4 | Арамызда бір сатқын бар ! | 4 Bolim
17:24
Will A Basketball Boat Hold My Weight?
00:30
MrBeast
Рет қаралды 85 МЛН
8 Data Structures Every Programmer Should Know
17:09
ForrestKnight
Рет қаралды 113 М.
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 96 М.
You don't really understand physics
11:03
Ali the Dazzling
Рет қаралды 129 М.
Viral Video of a Man's Crazy Job Interview
16:02
Darryl Vega TV
Рет қаралды 1,4 МЛН
How Fast Can I Fill My Inbox?
13:30
Dev Detour
Рет қаралды 349 М.
Algorithms Explained for Beginners - How I Wish I Was Taught
17:38
Internet Made Coder
Рет қаралды 356 М.
Dynamic Programming isn't too hard. You just don't know what it is.
22:31
DecodingIntuition
Рет қаралды 177 М.