[Java] Leetcode 498. Diagonal Traverse [Array #2]

Sdílet
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...

Komentáře • 7

  • @darshansimha2166
    @darshansimha2166 Před 2 lety +9

    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.

    • @EricProgramming
      @EricProgramming  Před 2 lety +3

      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.

    • @darshansimha2166
      @darshansimha2166 Před 2 lety +2

      @@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.

  • @asmitsrivastava924
    @asmitsrivastava924 Před rokem +1

    simple and beginner friendly

  • @MeetManga
    @MeetManga Před rokem +1

    i hate this kind of problems :)

  • @chaitanyasharma6270
    @chaitanyasharma6270 Před 2 lety

    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