2948. Make Lexicographically Smallest Array by Swapping Elements | leetcode daily challenge | dsa

Поділитися
Вставка
  • Опубліковано 25 січ 2025

КОМЕНТАРІ • 21

  • @shashwat_tiwari_st
    @shashwat_tiwari_st  День тому +5

    like target for this video is 170. Please do like if you have understood the explanation as well as the code😄😄

  • @KedarBhawthankar
    @KedarBhawthankar День тому

    16:40 what a line very amazing explanation best

  • @sivateja.m9476
    @sivateja.m9476 День тому +1

    nice explanation bhayya. i think you are channel is underated

  • @DarkDragon-bz6qp
    @DarkDragon-bz6qp День тому

    Awesome Explanation🔥🔥..Question was tricky

  • @contentorwhat6452
    @contentorwhat6452 День тому

    Bro buhut achi videos banate ho ap literally best explanation of Question with example and everything like if i stuck at any point while doing leetcode i just watch your explanation part and code it by myself, itni acha smjh ata like coding wala part tk jana hi ni prta.

  • @ayushraj1268
    @ayushraj1268 День тому +3

    Although i don't do leetcode daily nowadays, I wanted to thank you bhaiya for your videos. Your solution videos helped me during my 7th sem placement season and because of that I cracked flipkart sde intern🛐🛐 few days back along with 3 other companies.

    • @shashwat_tiwari_st
      @shashwat_tiwari_st  День тому

      @@ayushraj1268 shabash congratulations 🎊 👏 and best of luck ❤️

  • @mituldwivedi4469
    @mituldwivedi4469 День тому +2

    bhaiya contests reviews bhi kardo na start please 🥺

  • @secretstar-tc6op
    @secretstar-tc6op День тому

    Can we solve this problem by using deque push the indices and use while pop back if limit condition is satisfied by num[dq.back()]-nums[i]

  • @harshjumnani7766
    @harshjumnani7766 День тому

    i used List instead of ArrayList and it gave TLE, such a small diff can give tle

  • @mathscracks10
    @mathscracks10 День тому

    Here we divided into groups and made sure that group is sorted in main array
    There are chances multiple answer are possible bcoz ther could be lexicographic smaller array with different elements
    If question was not lexicographic but minimum possible array then this won't work bcoz once first swapping is done it is possible after swap element which is at other place could be smaller in some other group ?

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd День тому +1

    ❤❤

  • @sumit2483
    @sumit2483 День тому

    9/11 ke beech ka difference 2 hain ☠...thank you for the video bhai

  • @rishavshrivas7017
    @rishavshrivas7017 День тому

    Bhaiya code ko skip krke baki sab samj 😅 aya

  • @mr.ayurvedic01
    @mr.ayurvedic01 День тому

    i make the 150th like

  • @OnstreamGaming
    @OnstreamGaming 3 години тому

    I have solved it using a QUEUE :
    int n=nums.length;
    int sorted[] = Arrays.copyOfRange(nums,0,n);
    Arrays.sort(sorted);
    //grouping and put each element to map with their group
    List list = new ArrayList();
    Map map = new HashMap();
    list.add(new LinkedList(List.of(sorted[0])));
    map.put(sorted[0], 0);
    for(int i=1; i