Matrix Diagonal Sum (LeetCode 1572) | Full solution with visuals | 2 possible scenarios

preview_player
Показать описание


Chapters:
00:00 - Intro
00:50 - Problem Statement
02:28 - 2 possible scenarios
05:57 - Solution
07:46 - Dry-run of Code
10:33 - Final Thoughts

📚 Links to topics I talk about in the video:

📖 Reference Books:

🎥 My Recording Gear:

💻 Get Social 💻

#leetcode #programming #interview
Рекомендации по теме
Комментарии
Автор

Dude is a genius-level teacher! Thanks a lot!

ChibuzorEze-fn
Автор

DSA course from nikhil Bhai, will take unemployment away🙂

Homelander_
Автор

ur explanation is amazing..Thankyou sm!!!

topricano
Автор

Hi Nikhil, I just landed on your channel through YouTube recommendations. Your explanation is looking very clear and crisp. Just want to know, you have used Java in all your videos ??

abhinavsharma
Автор

19:25, 10 July watching
Jump game leetcode searched.

jayeshpatil
Автор

sir please start Leetcode 150 interview questions sheet

vikramdeshmukh
Автор

actually we can check if (i == n - i -1) then do not add that element twice. just a suggestion

cooltechie
Автор

Hello sir, Is there any online classes taken you on zoom or google meet for problem solving?

rih
Автор

@Nikhil Lohia, great work! I’m a big fan of yours. I have a better version of it; please check it out and please comment on it.

public int diagonalSum(int[][] mat) {
int sum =0;
int j= mat.length-1;
for(int i=0; i<mat.length; i++){
int primary = mat[i][i];
sum= sum+primary;
if(j!=i){
int secondary = mat[j][i];
sum = secondary+sum;
}
j--;
}
return sum;
}

s