1424. Diagonal Traverse II | 2 Ways | Matrix Diagonal Trick | BFS

Поделиться
HTML-код
  • Опубликовано: 9 окт 2024

Комментарии • 14

  • @ARYANMITTAL
    @ARYANMITTAL  10 месяцев назад +9

    Do look at both the approaches and also an extra diagonal trick in this, can be asked as a follow up question ❤!

  • @rodihub9836
    @rodihub9836 10 месяцев назад +4

    Consistency 100%

  • @ShubhamPatil-l1l
    @ShubhamPatil-l1l 10 месяцев назад +1

    1

    • @ARYANMITTAL
      @ARYANMITTAL  10 месяцев назад +2

      Line 3 is your comment is your answer 🙃

  • @codewithsunil5990
    @codewithsunil5990 10 месяцев назад +1

    Amazing explanation, keep going 😊

  • @sarankumaar6009
    @sarankumaar6009 10 месяцев назад

    bfs explanations is awsome.

  • @sangdilbiswal30
    @sangdilbiswal30 4 месяца назад

    I think we should use a map instead of an un ordered map in the first approach

  • @mohdkhaleeq7468
    @mohdkhaleeq7468 10 месяцев назад

    great solution will you tell me how space complexity is O(sqrt(n)) ?

    • @sukhpreetsingh5200
      @sukhpreetsingh5200 10 месяцев назад

      Because at any instant only at max sqrt(n) element can be present within a queue because in bfs we go level by level. Do a dry run for better understanding,

  • @kumarc4853
    @kumarc4853 5 месяцев назад

    nice!!, thx

  • @ashtron1585
    @ashtron1585 10 месяцев назад

    Day-3 :
    My submission for today:
    Code in java:
    class Solution {
    public int[] findDiagonalOrder(List nums) {
    int maxSum=0;
    ArrayList ans=new ArrayList();
    HashMap hmap= new HashMap();
    for(int i= nums.size()-1;i>=0;i--){
    for(int j=0;j

  • @kashyapjain2018
    @kashyapjain2018 10 месяцев назад +2

    Bhai sab theek hai ,punjabi nahi aati toh mat bola kar please

  • @ands403
    @ands403 10 месяцев назад

    2nd one approach is super sexiii, aryan bro .
    I have been able to do myself in nlong n time 🥲🥲