Count Inversions in an Array | Brute and Optimal

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 2024

ความคิดเห็น • 211

  • @takeUforward
    @takeUforward  ปีที่แล้ว +15

    Please watch our new video on the same topic: th-cam.com/video/AseUmwVNaoY/w-d-xo.html

    • @namannema3349
      @namannema3349 9 หลายเดือนก่อน +4

      this link take u to the same video we are watching

    • @yogeshkaushik8316
      @yogeshkaushik8316 5 หลายเดือนก่อน +15

      @@namannema3349 thats what recursion means

    • @user-ic7xs9vh7i
      @user-ic7xs9vh7i 9 วันที่ผ่านมา

      @@yogeshkaushik8316 😆

  • @satvrii
    @satvrii ปีที่แล้ว +112

    Nowadaya strivers voice has become so calm and soft 😅❤

    • @anuradha3868
      @anuradha3868 ปีที่แล้ว +6

      True...as compared to his previous vdos 😂

    • @newsbuster2194
      @newsbuster2194 10 หลายเดือนก่อน +1

      😂

    • @shubhamkumar-hx1fb
      @shubhamkumar-hx1fb 8 หลายเดือนก่อน

      ​@@anuradha3868 same thought 😂

    • @saswatrath4646
      @saswatrath4646 5 หลายเดือนก่อน

      abe mic kharap tha pehle😂

  • @anuplohar23
    @anuplohar23 8 หลายเดือนก่อน +24

    Best count inversion video on TH-cam, your method of teaching is very best that it gets me understand very easily 🌟🌟🌟

  • @Manishgupta200
    @Manishgupta200 ปีที่แล้ว +21

    I'm trying this problem and solved it by myself by taking count as global variable.. But you taught us in a vary optimal way without taking count as a global variable. Really best optimal approach. Thankyou ❤

    • @bishakhdutta8427
      @bishakhdutta8427 ปีที่แล้ว +1

      whats the complexity of your solution?
      can you share it?

    • @Manishgupta200
      @Manishgupta200 ปีที่แล้ว +1

      @@bishakhdutta8427 same as merger sort merge algorithm

  • @attackgaming9940
    @attackgaming9940 หลายเดือนก่อน +4

    Making the complex problem looks simpler is a kind of skill that striver only has🛐

  • @_AASHISHSHAH
    @_AASHISHSHAH ปีที่แล้ว +13

    this is the best playlist in world. thank you stiver for your effort.

  • @senseiAree
    @senseiAree 11 หลายเดือนก่อน +6

    Striver your voice is very soothing and calm bro ❤.... I use it to sleep at night AND study... and I don't feel sleepy

  • @SuvradipDasPhotographyOfficial
    @SuvradipDasPhotographyOfficial ปีที่แล้ว +12

    The best count inversion video on TH-cam.. Thanks a lot Raj.. stay blessed❤

  • @bmishra98
    @bmishra98 หลายเดือนก่อน +1

    Completed the playlist. This was the best recursion playlist I ever went through. Thanks a lot Striver.

  • @cinime
    @cinime ปีที่แล้ว +16

    Understood! Super amazing explanation as always, thank you very very very much for your effort!!

  • @gajendrakumar8271
    @gajendrakumar8271 4 หลายเดือนก่อน +2

    Finally completed this recursion playlist and Thanks a lot striver for great explanation throughout and patiently drawing recursion tree. patience is the key to solve and teach anything . And you have it man and you are teaching that too. Thanks a lot again

  • @xtzyrox2764
    @xtzyrox2764 ปีที่แล้ว +13

    I am happy with the brute force now I will see optimal 1 week before interview bcz University exams are in this month

  • @Cartidise
    @Cartidise ปีที่แล้ว +14

    I usually don't comment but wanted to say that just subbed your channel. This is the best explanation I've ever got. THANKS A LOT:>)

  • @user-jm6bc3rt5e
    @user-jm6bc3rt5e 3 หลายเดือนก่อน +1

    Understood
    THE BEST EXPLANATION
    Excellent playlist 👌 👏 ❤

  • @the_haryannvi_coder
    @the_haryannvi_coder 3 หลายเดือนก่อน

    If u don't wanna use cnt in mergeSort function, you can do this:-
    int mergeSort(vector &arr, int low, int high) {
    if (low >= high) return 0;

    int mid = (low + high) / 2 ;
    int left = mergeSort(arr, low, mid); // left half
    int right = mergeSort(arr, mid + 1, high); // right half
    int m = merge(arr, low, mid, high); // merging sorted halves
    return left + right + m;
    }

  • @prateek5208
    @prateek5208 หลายเดือนก่อน

    such an awesome expalination bhaiya just approach dekhkr hi dimag ma intution agya ki merge ma kase implement krenge , you are best

  • @selvaarumugam370
    @selvaarumugam370 ปีที่แล้ว +2

    As usual your teaching jus made coding much easier than it is bruh!! Waiting for Binary Search series bruh!!!!

  • @KapilMaan-vw9sd
    @KapilMaan-vw9sd วันที่ผ่านมา

    thanks sir for making this wonderful video sir !!!

  • @8bit_hero850
    @8bit_hero850 5 หลายเดือนก่อน +11

    Can we realistically solve this if it comes in an interview given we haven't solved it before? I mean how do can you get the intuition of merge sort from this problem? I really don't get it.

    • @unknown47896
      @unknown47896 หลายเดือนก่อน

      no way bro

    • @flakky626
      @flakky626 28 วันที่ผ่านมา

      Exactly my thought, No way you gonnna come up with something like that on your own

  • @shaikhanuman8012
    @shaikhanuman8012 12 วันที่ผ่านมา

    good explanation on count inversion

  • @akritisneh2849
    @akritisneh2849 ปีที่แล้ว +4

    So much crystal clear!!!!Thank youu❤

  • @SaumyaSharma007
    @SaumyaSharma007 ปีที่แล้ว +1

    OMG Bawal explanation Striver Bhaiya.😃

  • @elamaran350
    @elamaran350 4 วันที่ผ่านมา +1

    Understood ❤ At last

  • @mehulthuletiya497
    @mehulthuletiya497 ปีที่แล้ว +21

    Timestamps:
    ---------------------
    00:40 Problem Statement
    02:11 Brute force approach
    02:52 Pseudocode
    03:35 Complexity
    04:05 Optimmal solution
    04:22 Intuition
    10:33 Approach + Dry-run
    18:02 Code
    22:37 Complexity

  • @aditijagtap7853
    @aditijagtap7853 หลายเดือนก่อน

    Best teaching approach so far!!!!

  • @prateekgoyal7009
    @prateekgoyal7009 ปีที่แล้ว +1

    This is the best explanation I've ever got.

  • @shiveshgupta1705
    @shiveshgupta1705 ปีที่แล้ว +1

    i just imagine if all the problems would be available on this channel in future

  • @vaibhav56
    @vaibhav56 2 หลายเดือนก่อน

    I was struggling with the solution but as soon as you mentioned merge sort it clicked in my mind

  • @pallavi22222
    @pallavi22222 ปีที่แล้ว +1

    your problem solving approach explanation is superb

  • @vikasbagri1225
    @vikasbagri1225 ปีที่แล้ว +3

    Understood it very well
    Thanks for this amazing series

  • @abhaypatel379
    @abhaypatel379 2 หลายเดือนก่อน

    thanks striver for making a complex question into very easy question
    🤗

  • @HR-pz7ts
    @HR-pz7ts 4 หลายเดือนก่อน

    Amazing I solved two questions using the same logic.

  • @chiragbirla5606
    @chiragbirla5606 ปีที่แล้ว +1

    Best explanation ever for this problem

  • @nishant4595
    @nishant4595 2 หลายเดือนก่อน +1

    understood!!!

  • @lakshaysawhney9988
    @lakshaysawhney9988 2 หลายเดือนก่อน

    Thoroughly enjoyed the problem!!

  • @user-ck6kn1ty8x
    @user-ck6kn1ty8x 7 หลายเดือนก่อน +1

    Thank You Bhaiya

  • @harigs72
    @harigs72 4 วันที่ผ่านมา +1

    Happy teacher day 🎉❤

  • @mohd786ishaan
    @mohd786ishaan ปีที่แล้ว +1

    UNDERSTOOD SIR ! GREAT EXPLAINATION

  • @gauristar4094
    @gauristar4094 2 หลายเดือนก่อน

    Superb logic, Understood!!!

  • @AbjSir
    @AbjSir 11 หลายเดือนก่อน

    // Everytime while sorting you move an element to the left (assume nobody moves to right agar chote walo ko aana hoga to left me aa jayenge)
    // if an element crosses another element while moving to the left for the purpose of sorting then it should increase the count of inversion

  • @yashisrivastava6196
    @yashisrivastava6196 ปีที่แล้ว +1

    just wow explanation

  • @pushankarmakar1783
    @pushankarmakar1783 7 หลายเดือนก่อน +1

    understood!
    def merge(arr,l,mid,h):
    temp=[]
    i=l
    j=mid+1
    cnt=0
    while i

  • @muqeemuddin8057
    @muqeemuddin8057 6 หลายเดือนก่อน +1

    Hey, can you make a video on binary insertion sort and compare it's time complexities with insertion sort. Thanks for your videos on DSA.

  • @NoniSabharwal
    @NoniSabharwal 4 หลายเดือนก่อน

    The way he said wow! Uff in love with the voice

  • @MJBZG
    @MJBZG 2 หลายเดือนก่อน +1

    didn't understand much but will try again

  • @sukhpreetsingh5200
    @sukhpreetsingh5200 ปีที่แล้ว +1

    Understood amazing explanation

  • @ishasinghal3457
    @ishasinghal3457 9 หลายเดือนก่อน

    Best explanation ever

  • @GuruPrasadShukla
    @GuruPrasadShukla ปีที่แล้ว +1

    understood the approach sir
    thanks alot

  • @theresilientpianist7114
    @theresilientpianist7114 8 หลายเดือนก่อน

    Really it was a great series Striver.🔥🔥

  • @ishangujarathi10
    @ishangujarathi10 11 หลายเดือนก่อน

    loved the optimal solution, intuition op!

  • @Sumeet_100
    @Sumeet_100 8 หลายเดือนก่อน

    Thank you for this video !!

  • @NazeerBashaShaik
    @NazeerBashaShaik 5 หลายเดือนก่อน

    Understood, thank you.

  • @pavanjegurupati
    @pavanjegurupati 5 หลายเดือนก่อน

    Great explanation!!

  • @unnatishukla8513
    @unnatishukla8513 ปีที่แล้ว +1

    awesome as always!!!!🤩

  • @steverogers7050
    @steverogers7050 5 หลายเดือนก่อน

    very nice explanation bhaiya

  • @vk-mc5tq
    @vk-mc5tq 5 หลายเดือนก่อน

    Global vs Local
    In Global variables values updated dynamically but in local variables we need to pass updated values (manually) to subsequent functions

  • @abhishekverma4693
    @abhishekverma4693 6 หลายเดือนก่อน

    thank you so much for watching

  • @DeadPoolx1712
    @DeadPoolx1712 19 วันที่ผ่านมา

    UNDERSTOOD;

  • @anshasati1920
    @anshasati1920 2 หลายเดือนก่อน

    Understood Sir🥳

  • @sivasaimanchem4399
    @sivasaimanchem4399 ปีที่แล้ว

    All i can say is Thankyou so much ❤🙌

  • @navdeepkumar9160
    @navdeepkumar9160 ปีที่แล้ว +1

    Great video

  • @hashcodez757
    @hashcodez757 5 หลายเดือนก่อน

    understood Bhaiya!!

  • @anushkajain8480
    @anushkajain8480 หลายเดือนก่อน

    Understood.

  • @RIyaGupta-iz9iw
    @RIyaGupta-iz9iw หลายเดือนก่อน

    Understand bhaiya

  • @saitehith6647
    @saitehith6647 ปีที่แล้ว

    Superb Explanation

  • @satyamgupta4808
    @satyamgupta4808 ปีที่แล้ว +1

    very nice video

  • @sarangkumarsingh7901
    @sarangkumarsingh7901 5 หลายเดือนก่อน

    Nice lecture................

  • @rohitkumarpilania94
    @rohitkumarpilania94 ปีที่แล้ว

    Badhiya kaam kar rahe ho, see you soon

  • @AnjuGupta-sz1uk
    @AnjuGupta-sz1uk ปีที่แล้ว +1

    understood

  • @grm642
    @grm642 7 หลายเดือนก่อน

    Thank you😊

  • @ShubhamKumar-uf3gc
    @ShubhamKumar-uf3gc 2 หลายเดือนก่อน

    loved that bhaiya

  • @ravalikatalks5285
    @ravalikatalks5285 7 หลายเดือนก่อน

    thanks alot bhaiya

  • @hemantpatel1413
    @hemantpatel1413 2 หลายเดือนก่อน

    understood.

  • @nayankhuman1043
    @nayankhuman1043 2 หลายเดือนก่อน

    Understood :)

  • @pawan_kk
    @pawan_kk 9 วันที่ผ่านมา

    understood

  • @atharva3571
    @atharva3571 8 หลายเดือนก่อน

    I understood the problem

  • @vivekbhore5722
    @vivekbhore5722 5 หลายเดือนก่อน

    thank u striver

  • @her_soulmate
    @her_soulmate 9 หลายเดือนก่อน

    Understood 🎉

  • @YourCodeVerse
    @YourCodeVerse 10 หลายเดือนก่อน

    Understood✅🔥🔥

  • @Sameer-wm8dn
    @Sameer-wm8dn 2 หลายเดือนก่อน

    Understood

  • @user-je7tz6le4k
    @user-je7tz6le4k ปีที่แล้ว +3

    These types of questions always demotivate me... like how you can think of such kind of solution in an interview

  • @nikhilprakashahir5730
    @nikhilprakashahir5730 7 หลายเดือนก่อน

    so aweesome

  • @JRK_RIDES
    @JRK_RIDES 4 หลายเดือนก่อน

    Understood!

  • @GhostVaibhav
    @GhostVaibhav 6 หลายเดือนก่อน

    Understood🔥

  • @ajaykr2811
    @ajaykr2811 11 หลายเดือนก่อน

    13:05 the kind of excitement I want while learning DSA.

  • @culeforever5408
    @culeforever5408 10 หลายเดือนก่อน +1

    understood :)

  • @abhishekahirvar7783
    @abhishekahirvar7783 3 หลายเดือนก่อน

    thanks mate

  • @venup2813
    @venup2813 ปีที่แล้ว

    Understood brother❤️

  • @user-lw9dj8we7k
    @user-lw9dj8we7k 8 หลายเดือนก่อน

    Understood sir

  • @HarshChoudhary-vm6eh
    @HarshChoudhary-vm6eh ปีที่แล้ว

    Understood thats great...

  • @ayushvyas5212
    @ayushvyas5212 หลายเดือนก่อน

    awesome

  • @infomania_by_ayush7901
    @infomania_by_ayush7901 2 หลายเดือนก่อน +1

    Understood, but I am gonna need some time to implement this.

  • @divyaanandhan6021
    @divyaanandhan6021 ปีที่แล้ว

    Thanks 😊👍

  • @user-nk1mb5fy7j
    @user-nk1mb5fy7j ปีที่แล้ว

    UNDERSTOOD

  • @jayshukla6096
    @jayshukla6096 ปีที่แล้ว

    Understood!

  • @varunpalsingh3822
    @varunpalsingh3822 ปีที่แล้ว

    understood 👍👍

  • @DSAMADESIMPLE
    @DSAMADESIMPLE ปีที่แล้ว

    Understood sir

  • @pritipatil4021
    @pritipatil4021 ปีที่แล้ว

    Understood...!!!!

  • @vikasgupta1828
    @vikasgupta1828 ปีที่แล้ว

    Thanks

  • @mount2020
    @mount2020 ปีที่แล้ว

    Thank u bhai