Matrix Diagonal Sum Solution | LeetCode 1572
I have explained matrix diagonal sum solution. Please watch till the end as if you are facing any problem related with matrix or 2D array you will be able to think in this way.
Description
Given a square matrix mat, return the sum of the matrix diagonals.
Only include the sum of all the elements on the primary diagonal and all the elements on the secondary diagonal that are not part of the primary diagonal.
Input: mat = [[1,2,3],
[4,5,6],
[7,8,9]]
Output: 25
Explanation: Diagonals sum: 1 + 5 + 9 + 3 + 7 = 25
Notice that element mat[1][1] = 5 is counted only once.
Please let us know in comments section if you like the approach.
Problem Link:
https://leetcode.com/problems/matrix-...
Solution Link:
https://github.com/codedecks-in/LeetC...
🔴 DONT CLICK THIS: https://bit.ly/2BuO3Pt
✅ Recommended playlists ►
👉 Hackerrank WarmUp Algorithms: • Hackerrank WarmUp Solutions | Hackerrank P...
👉 HackerRank Java Solutions: • HackerRank Java Practice Solutions | Compe...
👉 Java Loops Explanation: • Java Loops 1 and 2 hackerrank solution | c...
👉 Interview Programming: • LeetCode Solutions | Coding Interview Prep...
📖 LEARNING RESOURCES
1) Cracking the Coding Interview: https://amzn.to/3fH727G
2) Data Structures and Algorithms Made Easy in Java: https://amzn.to/3fJXsRC
3) Data Structure and Algorithmic Thinking with Python: https://amzn.to/30Ldczp
4) Grooking Algorithms: https://amzn.to/3aeTcrV
5) Dynamic Programming for Coding Interviews: https://amzn.to/31K16po
👋 Let’s Connect ►
👉 Github: https://github.com/codedecks-in/
👉 Instagram: / codedecks_in
👉 Twitter: / codedecks
👉 Fb group: / codedecks
Quick look:
0:00 Intro
Like | Share | Subscribe to codedecks
Happy Learning !!!
#codedecks #leetcode1572 #matrixdiagonalsum
matrix diagonal sum,matrix diagonal sum java,matrix diagonal sum solution,1572. matrix diagonal sum,1572. matrix diagonal sum leetcode,leetcode 1572,problem 1572,matrix diagonal sum c++,matrix diagonal sum python,java,python,c++,leetcode 1572,september leetcoding challenge,leetcode challenge,programming,interview,solution,google,facebook,amazon,hackerrank,algorithm,matrix diagonal sum leetcode,knowledge center,coding interview,geeksforgeeks,question,amazon coding interview,weekly challenge
DISCLAIMER: These above-mentioned resources have affiliate links, which means if you buy one of the products from my links, I might receive a small commission without having an extra cost to you. This helps support the channel and allows us to continue to add more tutorials. Thank you for all your support !!!
Информация по комментариям в разработке