2614. Prime In Diagonal

  Рет қаралды 22

CodeVia

CodeVia

7 ай бұрын

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 7 ай бұрын
Great!
Nature's Incredible ROTATING MOTOR (It’s Electric!) - Smarter Every Day 300
29:37
The moment we stopped understanding AI [AlexNet]
17:38
Welch Labs
Рет қаралды 798 М.
Best KFC Homemade For My Son #cooking #shorts
00:58
BANKII
Рет қаралды 64 МЛН
НЫСАНА КОНЦЕРТ 2024
2:26:34
Нысана театры
Рет қаралды 926 М.
"Only Carlsen Could Play Such A Move And Not Feel Like A Fool"
12:38
Diameter of Binary Tree - Leetcode 543 - Python
7:26
NeetCodeIO
Рет қаралды 296
Unifi Enterprise Fortress Gateway
14:36
Mactelecom Networks
Рет қаралды 11 М.
Leetcode | 15. 3Sum | Medium | Java Solution
10:15
Developer Docs
Рет қаралды 767
Rubik's Cube North American Championship 3x3 Finals!
24:39
TheCubicle
Рет қаралды 1,4 М.
OpenAI's New SearchGPT Shakes Up the Industry, Google Stock CRASHES!
10:10
Best KFC Homemade For My Son #cooking #shorts
00:58
BANKII
Рет қаралды 64 МЛН