[Java] Leetcode 498. Diagonal Traverse [Array #2]
Vložit
- čas přidán 24. 07. 2024
- In this video, I'm going to show you how to solve Leetcode 498. Diagonal Traverse which is related to Arrays.
In fact, I also have a whole section of solving leetcode questions and categorize them: czcams.com/users/EricProgram...
Here’s a quick rundown of what you’re about to learn:
Course Contents
(0:00) Question Walkthrough
(0:59) Solution Explain
(2:30) Code
In the end, you’ll have a really good understanding on how to solve Leetcode 498. Diagonal Traverse and questions that are similar to Arrays.
Now, if you want to get good at Arrays, please checkout my Arrays playlist.
• Leetcode: Arrays
💻 Code: github.com/Eric-programming/C...
In what universe is x, the column coordinate and y, the row coordinate? I understood the logic but the x and y made it 1000% difficult and confusing. Rene Descartes is rolling in his grave.
True, I agree. I did realize that later as well, so if you look at the recent videos that I made. I started to use "row" and "col" instead of x and y as variable name. Thank you for pointing this out.
@@EricProgramming Thank you so much! It was just a rant. I felt bad for posting it. But you were such a gentleman about it. Thank you again for the help.
simple and beginner friendly
Glad you think so!
i hate this kind of problems :)
public int[] findDiagonalOrder(int[][] mat) {
int m=mat.length;
int n=mat[0].length;
int a[]=new int[m*n];
int max=m+n-2;
int c=0;
int spiral=1;
for(int s=0;s