Subarray Sum Equals K | Count Subarrays with Sum Equals K | Hashmap Interview Questions Playlist

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

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

  • @sleepypanda7172
    @sleepypanda7172 3 года назад +43

    I understood within the first 1:11 minutes because your way of explaining was crystal clear. Thanks a lot!

  • @vadirajjahagirdar9342
    @vadirajjahagirdar9342 3 года назад +38

    Best teacher for coding on RUclips. Hands down, nobody is even close to him. Thanks Sir. I wish to meet you one day and thank you for your videos.

  • @sachinkarve5272
    @sachinkarve5272 2 года назад +3

    Excellent. As someone said, the solution was clear within the first minute. Awesome!

  • @layashmaveeramalla2251
    @layashmaveeramalla2251 Месяц назад +1

    I am very thankful to you sir,you clear explanation of such simple things make us understand big concepts

  • @thegreekgoat98
    @thegreekgoat98 2 года назад +2

    One of the brilliant explanation to this problem on entire RUclips

  • @cavi8779
    @cavi8779 2 года назад

    poori u tube mein sabse acha coding explanation aap hi kre ho.....jb b kisi qsn mein fnstaa hoon or us qsn ki aap ki vdo mil jaati hai to man bahoot hi khush hoo jata hai😊😊

  • @sameersondur9030
    @sameersondur9030 3 года назад +11

    Absolutely Fantastic!! I am amazed by your ease to explain.
    Appreciate your help. I will send your links to my friends who are prepping.

    • @Pepcoding
      @Pepcoding  3 года назад +1

      Awesome, thank you so much

  • @vetiarvind
    @vetiarvind 2 года назад +4

    Amazing, i am not a hindi native speaker but i understood your explanation perfectly. Nice idea of doing a run through the array and explaining k and y-k and maintaining count of prefix sum occurance.

  • @leslieamaron8053
    @leslieamaron8053 3 года назад +8

    Bro, thanks for explaining everything with so much patience. Finally samajh me aaya ki subarrays += map[prefSum - k] kyu kar rhe hai.
    Possible variations of question:
    > Find if subarray with sum exists; find range
    > Find biggest/smallest subarray with sum; range
    > Find no. of subarrays with sum; find ranges

    • @Pepcoding
      @Pepcoding  3 года назад

      Thankyou
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

    • @sriramvemaraju845
      @sriramvemaraju845 3 года назад +1

      Please try to explain in english. I understand hindi no worries for me. I could not find this explanation anywhere on RUclips. You have a unique skill and deserve to have an international audience.

  • @ravimishra8632
    @ravimishra8632 3 года назад +5

    Had trouble getting this ques, 4th video for on this question. Finally got it. Thanks a lot. You teaching style is great!

    • @X_y_zaid
      @X_y_zaid 7 месяцев назад

      3rd for me😂

  • @ArjunSingh-of6vm
    @ArjunSingh-of6vm 3 года назад +17

    literally nice way to explain

    • @Pepcoding
      @Pepcoding  3 года назад +1

      Thankyou beta,
      I am glad you liked it. I also hope that you are watching till end.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )

  • @tejasgulati3080
    @tejasgulati3080 3 года назад +10

    Thank you soo much. You are a savant at explaining these. This is the most straightforward video on the topic. Keep up the good work my man!

    • @Pepcoding
      @Pepcoding  3 года назад

      Glad to know that you liked the content and thank you for appreciating.
      The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
      So, keep motivating, keep learning and keep loving Pepcoding😊

    • @rahulranjan7567
      @rahulranjan7567 3 года назад

      Savant, yes thats the word I would use to describe his explaining skills. He can single handedly jack up the toughness levels of interviews and this will happen in coming days. After his videos it becomes easy to visualize stuffs. Bass DP nahi phoot rahi merese lol

    • @ridgeadam8442
      @ridgeadam8442 3 года назад

      I know Im randomly asking but does any of you know of a trick to get back into an Instagram account?
      I stupidly lost my login password. I would appreciate any assistance you can offer me

    • @isaacbobby8571
      @isaacbobby8571 3 года назад

      @Ridge Adam Instablaster ;)

    • @ridgeadam8442
      @ridgeadam8442 3 года назад

      @Isaac Bobby i really appreciate your reply. I got to the site through google and I'm trying it out now.
      Looks like it's gonna take quite some time so I will get back to you later when my account password hopefully is recovered.

  • @pankajkohli9263
    @pankajkohli9263 3 года назад +4

    Very Nice explanation. Thanks for covering the edge case scenario when index from 0 to "i" itself is sum. I have solved this problem before but never thought of this case. Thanks again Sumeet Sir, Thanks Pepcoding :)

    • @Pepcoding
      @Pepcoding  3 года назад +1

      Glad to know that you liked the content and thank you for appreciating.
      The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
      So, keep motivating, keep learning and keep loving Pepcoding😊

  • @vishalbarvaliya2849
    @vishalbarvaliya2849 2 года назад

    Sir.....apni jaaan & puri shiddat se padhata hai..ki...bas yahi efforts se kisika bhi interest and intuitions badh jayenge. Hats OFF

  • @SanaAnsari9618
    @SanaAnsari9618 8 месяцев назад

    After watching your video I got this problem, I tied up with this problem since long . finally you made me rid of it.

  • @sparshgupta9900
    @sparshgupta9900 3 года назад

    Literally feel aati hai sir aapse padke. The reason is aap proper teacher lagte ho..jaisa hame 12 and iit tak mile hai and unse padkar feel aata hai padai kaa

    • @Pepcoding
      @Pepcoding  3 года назад +1

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @muskansawa2802
    @muskansawa2802 3 года назад

    tysm , itna acha hota hai jab koi hindi mai batat hai , kyuki i also think in hindi , dusre tutorial samjne mai jyada time lagta hai , thanks thanks thanks!

    • @Pepcoding
      @Pepcoding  3 года назад

      Thank you so much and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @mansigoyal4796
    @mansigoyal4796 3 года назад +1

    Best channel ever. Sir you teach questions in very friendly way. Thanku sir 😊

    • @Pepcoding
      @Pepcoding  3 года назад +1

      Thankyou beta!
      I am glad you liked it. I also hope that you are watching till the end and trying to understand the what, how, and especially why of the problem. If you like our efforts, will you like to review us here - g.page/Pepcoding/review?rc

  • @atmanirbharladka4467
    @atmanirbharladka4467 2 года назад +1

    I watched 3-4 videos for this question. Here, I understood the concept in the first 1 min.

    • @Pepcoding
      @Pepcoding  2 года назад +2

      Glad it helped!
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @hehebohey3747
    @hehebohey3747 6 месяцев назад

    I was soo confused for this problem But sir you Have Explained Excellent

  • @sujan_kumar_mitra
    @sujan_kumar_mitra 3 года назад +1

    Your dry run skills are really good!

  • @cenacr007
    @cenacr007 2 года назад

    Everytime I face a coding problem and come to utube to look for a solution, my only hope is I find a solution video by Sumeet Sir.

    • @Pepcoding
      @Pepcoding  2 года назад

      Happy to help!
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

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

    sir i try to clear this question from many youtuber but the way you clearly show dry run hands down sir

  • @dhruvasoni6454
    @dhruvasoni6454 2 года назад

    best explaination sir, abhi ek hi video dekh rha thaa and he told me , rat ko imeediate apki dekhi and crsytal clear ++, app c++ mein bhi code kare, it would helpfull for many students

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

    BEST EVER EXPLANATION.

  • @piyushgaur6188
    @piyushgaur6188 3 года назад

    Sir ji DilJeet aapki explanation.....PEPCODING ROCKS👌❤

  • @gayatrih2241
    @gayatrih2241 7 месяцев назад

    Your explanation has always been helpful!

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

    Thanks a lot for this video. Seeing this for my interview preparation.

  • @tanvitripathi5743
    @tanvitripathi5743 2 года назад +1

    Very kind person

  • @newbiehype4505
    @newbiehype4505 Месяц назад

    no one explain better than this representation. 👌🏼☕

  • @saicharank9143
    @saicharank9143 Год назад +1

    Awesome explanation

  • @balwantyadav724
    @balwantyadav724 3 года назад +1

    sir ekdam mast padhaate ho aap har topic ko.. fan ho gya aapka sir

    • @Pepcoding
      @Pepcoding  3 года назад +1

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @artyCrafty4564
    @artyCrafty4564 11 месяцев назад

    Underrated channel

  • @vandanabanny7550
    @vandanabanny7550 2 года назад

    I was searching for this video, you nailed it. Thanks a ton :)

  • @aakashyadav6228
    @aakashyadav6228 3 года назад

    Congratulations on 50K. Many more achievements to come !!

  • @UEI_HimadriShekharChakraborty
    @UEI_HimadriShekharChakraborty 2 года назад

    Moment at 1:00 , made all my confusions disappear , was stuck for a while till now. Thanks sir

  • @sweabhishek
    @sweabhishek 24 дня назад

    Great explanation sir

  • @uniqueanshu4268
    @uniqueanshu4268 Год назад

    OMG.. What a explanation !🎉

  • @GauravThinks
    @GauravThinks 9 месяцев назад

    sumeet sir's explanation is 💎

  • @akhileshparmar1061
    @akhileshparmar1061 3 года назад

    You nicely explained this solution especially why 0 frequency should be added at the beginning. Thanks for making this video.

    • @Pepcoding
      @Pepcoding  3 года назад

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @karthiklv29
    @karthiklv29 2 года назад +1

    Even though i dont understand hindi very well, i come here for the amazing explanations :)

  • @rudreshajgaonkar
    @rudreshajgaonkar 2 года назад

    Gajab explanation. Ek number bhai.

    • @Pepcoding
      @Pepcoding  2 года назад

      Hope you love the explanation.
      For better experience and well organised content visit - nados.io and keep supporting us. 🙂

  • @DeepakSaini7900
    @DeepakSaini7900 3 года назад +1

    Gazab explain sir maza aa gya

  • @heenasharma5076
    @heenasharma5076 3 года назад

    Ur explanation is always very fluid in all your videos...must watch

    • @Pepcoding
      @Pepcoding  3 года назад

      Thankyou beta,
      I am glad you liked it. I also hope that you are watching till end.
      Will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms)

  • @shreyasvishwakarma8979
    @shreyasvishwakarma8979 3 года назад +2

    Thank you sir! Great Explanation so far!

    • @Pepcoding
      @Pepcoding  3 года назад

      Glad it was helpful! and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @sachinsharma905
    @sachinsharma905 3 года назад +1

    Great Explanation. Thank you for your help

  • @alokkulkarni10
    @alokkulkarni10 3 года назад +2

    Explanation mast hai.. English subtitles add kar do, International viewers bhi add ho jayenge

    • @Pepcoding
      @Pepcoding  3 года назад

      Thankyou!
      Hnji, krvata hu add beta technical team ko bol k

  • @sahiljain2524
    @sahiljain2524 3 года назад

    Nice explanation pata hi nhi chala kab khatam ho gya 😅.. Thank you 🙌

  • @aashritamutkiri5071
    @aashritamutkiri5071 2 года назад

    Very well explained!!!! Thank you sir!!!!!!

  • @md.rejwanahmed293
    @md.rejwanahmed293 3 месяца назад

    Thanks a lot man. Finalyy i have understood

  • @sahilkaul6199
    @sahilkaul6199 Год назад

    Thanks for teaching bhai

  • @tarunsingh5615
    @tarunsingh5615 2 года назад

    lovely explaination

  • @mercerkace2023
    @mercerkace2023 2 года назад

    Thanks for this easy explanation.

  • @tykunal
    @tykunal 2 месяца назад

    Bhai acha to tha waise , no doubt!!!

  • @iuashrafi
    @iuashrafi Год назад

    Great sir ! thankyou so much !

  • @GauravKumar-dw2ml
    @GauravKumar-dw2ml 2 года назад

    Thankyou for the awesome explanation.

  • @leetcode7091
    @leetcode7091 Год назад

    First 1 min made me understand the solution.

  • @sinister_rules
    @sinister_rules 2 года назад

    next level teacher👌👌

  • @sahilanand30
    @sahilanand30 2 года назад +1

    Best explanation

    • @Pepcoding
      @Pepcoding  2 года назад

      Glad you think so!
      For better experience and well organised content visit - nados.io

  • @pranays6503
    @pranays6503 Год назад

    Best explanation sir :)

  • @SarabjotSingh294
    @SarabjotSingh294 3 года назад

    This is a really great explanation! Great work.

  • @Vishalkumar-nl2ud
    @Vishalkumar-nl2ud 3 года назад

    Thank you for explanation, it really helps me.

  • @tishaagarwal9435
    @tishaagarwal9435 2 года назад

    thank u for the explanation

  • @GhostRider....
    @GhostRider.... 2 года назад

    Very clear explanation sir 🔥🔥

  • @harshagirish4579
    @harshagirish4579 3 года назад

    Excellent video. Great explanation

  • @WhiteFang-oq5dy
    @WhiteFang-oq5dy 2 месяца назад

    nice explanation

  • @shivammehta9661
    @shivammehta9661 3 года назад

    Very Nice Explanation.....Keep making videos

    • @Pepcoding
      @Pepcoding  3 года назад +1

      Sure. Keep learning, Keep growing and keep loving Pepcoding!😊

  • @muskansawa2802
    @muskansawa2802 3 года назад

    subha se jis problem mai fail hori thi , ek baar yeh vedio dekh ke hogaya , maine ferquency nai count kiya tha yeh mera mistake tha! itni khushi XD i wish i could give this vedio a heart ❤❤

    • @Pepcoding
      @Pepcoding  3 года назад

      Glad to know that you liked the content and thank you for appreciating.
      The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
      So, keep motivating, keep learning and keep loving Pepcoding😊

  • @sunilpanchal1498
    @sunilpanchal1498 2 года назад

    Great explanation sir, Keep it up

  • @ShabnamKhan-cj4zc
    @ShabnamKhan-cj4zc 3 года назад

    Awsome explanation. Thanks a lot for explaining in simple terms. Keep doing the great work.

    • @Pepcoding
      @Pepcoding  3 года назад

      Thankyou beta!
      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem. If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
      Keep learning and keep loving Pepcoding😊

  • @Joyddep
    @Joyddep 3 года назад

    Thanks for the explanation. Great visualization!

  • @gautamkhatik251
    @gautamkhatik251 2 года назад

    wish I could have been watch this video before, was able to save a big amount of time

  • @ZentrexGaming
    @ZentrexGaming 2 года назад

    sir maza aagaya firse

  • @sashantpardeshi2210
    @sashantpardeshi2210 3 года назад

    Time complexity - O(n.m)
    n - length of array.
    m - lenth of hash map for search operations.

    • @akshhay
      @akshhay 2 года назад

      Search in hashmap is O(1)

    • @sashantpardeshi2210
      @sashantpardeshi2210 2 года назад

      @@akshhay when there is hash collision then ??

  • @niteenautade
    @niteenautade 2 года назад

    Very well explained!

  • @abhishekkumargupta3605
    @abhishekkumargupta3605 2 года назад

    finally got it, thanks a lot😊

  • @1991deeps
    @1991deeps 3 года назад +1

    You should write continuous sub-array as this solution would not do for non-continuous sub-arrays.

  • @AI_focus
    @AI_focus 3 года назад

    Python implementation:
    def subarraySum( nums: List[int], k: int) -> int:
    map_freq={}
    sum_count=0
    ans=0
    map_freq[0]=1
    for i in range(len(nums)):
    sum_count+=nums[i]

    if (sum_count-k) in map_freq:
    ans+=map_freq.get(sum_count-k)

    if sum_count in map_freq:
    map_freq[sum_count]=map_freq[sum_count]+1
    else:
    map_freq[sum_count]=1

    return ans

  • @adarshupadhyay8738
    @adarshupadhyay8738 2 года назад +2

    sum 15 has a frequency 2 but bhaiya in the second occurence of sum 15 you have written 1 below it. it should be 2 not 1.

  • @madanmohanpachouly6135
    @madanmohanpachouly6135 2 года назад

    bahut sahee.

  • @atulsingh1438
    @atulsingh1438 2 года назад

    Awesome explanation 🔥

  • @hannanhub1717
    @hannanhub1717 2 месяца назад

    thanks

  • @subhamoyburman3093
    @subhamoyburman3093 4 года назад

    Bhaiya itne accha kaise samjha lete ho aap

  • @_inspireverse___
    @_inspireverse___ 2 года назад +1

    Wow ! So much wow

    • @Pepcoding
      @Pepcoding  2 года назад

      Glad you liked it!
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @sauravsemwal1346
    @sauravsemwal1346 3 года назад

    Sir , aapka explanation bhut bdiya hai...
    Video ke title me leetcode problem no. bhi dal do easily search me aayega.....

  • @SumitSingh-ui4do
    @SumitSingh-ui4do 2 года назад

    Great explanation ❤️🙏🙏🙏

    • @Pepcoding
      @Pepcoding  2 года назад

      Glad it was helpful!
      Keep learning.
      And for better experience and well organised content visit nados.pepcoding.com

  • @arupdas2210
    @arupdas2210 2 года назад

    I have just one doubt. If k=0 then "ans" should be "ans-1" and if ans-1

  • @hiteshbhatia5609
    @hiteshbhatia5609 2 года назад

    but how to print all those subarrays because if frequency of any sum is greater then 1 then how would we get more then 1 subarrays starting index from hashmap so that we can print all subarrays?

  • @akhileshkumarsingh3322
    @akhileshkumarsingh3322 Год назад

    gajab!!

  • @kishorchintalchere
    @kishorchintalchere 3 года назад

    Best explanation 🔥🔥✌️✌️👍👌👌

    • @Pepcoding
      @Pepcoding  3 года назад

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      ruclips.net/user/Pepcodingabout?view_as=subscriber

  • @rajugoud6465
    @rajugoud6465 3 года назад +1

    Great work Bro..

    • @Pepcoding
      @Pepcoding  3 года назад +2

      Thankyou beta!
      I am glad you liked it. I also hope that you are watching till the end and trying to understand the what, how, and especially why of the problem. If you like our efforts, will you like to review us here - g.page/Pepcoding/review?rc

  • @DSA_Coding
    @DSA_Coding 3 года назад

    gjb sir

  • @samarthsingh663
    @samarthsingh663 3 года назад

    Sir first of all thing thank you for the explanation but i wanted to know why 2 pointer approach is failing here.

  • @eshanikabhattacharjee383
    @eshanikabhattacharjee383 3 года назад +1

    how to get the intuition for such tricks

  • @bigdecimal4988
    @bigdecimal4988 3 года назад +1

    apne portal ko improve kro...caching ka use kro taki bina login kre agar submit kre to atleast code save rahe..
    btw apke videos kafi ache hai..

    • @Pepcoding
      @Pepcoding  3 года назад +1

      We ar hiring people for making our portal better. If you can help in this apply for it as well

  • @marlegagaming1274
    @marlegagaming1274 3 года назад

    I have watched multiple videos without understanding, finally your video helped bhai ❤

    • @Pepcoding
      @Pepcoding  3 года назад +1

      Glad it helped and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @Satyam_-bb5ly
    @Satyam_-bb5ly 3 года назад

    Could you please make a video on maximum subarray sum closest to k ?

  • @WizardsOfCode7
    @WizardsOfCode7 3 года назад +1

    but this is not working for array {1,2,3,4} and target value :6 output should be 2 ->{1,2,3} and {2,4} , but it is showing 1

  • @KinnarKansara
    @KinnarKansara 4 года назад

    Nicely explained!!

    • @Pepcoding
      @Pepcoding  4 года назад

      Glad you liked it
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      ruclips.net/user/Pepcodingabout?view_as=subscriber
      For clearing your doubts, you can join our community on telegram
      t.me/pepcoding

  • @moozaheed9568
    @moozaheed9568 3 года назад

    Love from BD