Find Subarray with the given sum k 🔥| Hashmap in Java | DSA-One Course #28

preview_player
Показать описание
Hey guys, In this video, We're going to solve a popular HashMap Problem, Find the subarray with given sum.

🥳 Join our Telegram Community:

🚀 Follow me on:

💸 Use coupon code ANUJBHAIYA on GeeksforGeeks to avail discounts on courses!

Hashtags:
#anujbhaiya #dsaone

Ignore these tags:

subarray with given sum
find subarray with given sum
subarray with given sum geeks for geeks
subarray with given sum geeksforgeeks
subarray with sum 0
subarray sum equals k
number of subarrays with sum equals k
subarray with given sum gfg
subarray with given sum c++
find subarray having given sum
subarray with given sum negative numbers
find the subarray with given sum
find the subarray having the given sum
find subarray with a given sum
hashmap
hashmap in java
java hashmap
hashmap java
how hashmap works
how hashmap works internally
hashmap vs hashtable
hashmap internals
java hashmap tutorial
hashmap internal working in java
design hashmap
hashmap internal implementation in java
design hashmap leetcode
hashmap java 8
hashmap interview questions
python hashmap
how hashmap works internally in java
code
what is hashmap in java
java hashmap explained
hashmap implementation
Рекомендации по теме
Комментарии
Автор

Adding variations to the problem statement is absolutely marvellous 👍

VivekChandra-vrgb
Автор

Anuj Bhaiya, You are the best educator for me🙏🙏💐
Take love & respect from West Bengal 💙
God bless you Bhaiya 😇

indiradas
Автор

Sir you teach the best!! I was stuck on this problem since past 2 days and now it's all clear. Thank you for this amazing content.

falakhasija
Автор

Thanks anuj bhaiya. You are building a great cornerstone for students. In between how to learn kubernetes and how to start learning devops. Could you please tell about this?

hawking
Автор

Nice to see practical implementation of hash map.

tejassontakke
Автор

OP Logic Building!
Able to think and code in correct way. Thanks a lot!

darshansomani
Автор

Bhaiya...it will be helpful if u provide some variation problems on every lecture...like u did here ( few more )❤️

arpanbhowmick
Автор

Bhaiya aapke videos se bohot acche se samaj aaraha hai thnank you.

ranchocomedy
Автор

Hey anuj. Thanks for the great content.


Tried doing the largest subarray with equal 0, 1 problem as mentioned at the end of this video.
I think its not a variant to this one and would be solved with a different logic altogether.


As if we do find subarray with sum zero, the algorithm of this video will find the LAST subarray with sum zero and not the LARGEST subarray with sum zero.

If I'm right, please do cut the end part of this video.

blackhawk
Автор

Valuable information... extraordinary teacher.. 💥💥

chandrakanthsagar
Автор

Bhaiya please focus and complete the DSA-One series🙏🏻 make your DSA-One series, better than Apna College, content wise. Because their content is very vast and lots of different questions, but explanation is not good. You're the god of explaining things❤️❤️
Ps- till now your content of Dsa-One is 🔥❤️

AyushSharma-zlfw
Автор

Brute force approach
int arr1[]={10, 5, 6, 1, 8, 5, 2};
for(int i=0;i<arr1.length;i++){
for(int j=i+1;j<arr1.length;j++){
if(arr1[i]+arr1[j]==7){
System.out.println(i+" "+j);
}
}
}

itzmanny
Автор

very well explained... i cam across this question while searching for another similar but a littile more complex... can you please help solve..
The Question is:- Given an array of integers of size N, count all possible distinct triplets whose sum is exactly divisible by given integer K. for triplets i, j, k --> i<j<k

stupidbutcurious
Автор

i spend my all day with anuj bhaiya, shradha didi, and geeksforgeeks

startupmindset
Автор

Also one single element is also part of the subarray, so the last element '5' is also part of the subarray;

ZSHADOW
Автор

We can also use the concept of Sliding Window to solve this problem without using extra Space in the 1st Problem.

dhruvilsoni
Автор

Thanks
There is one more variation, that you have to count the num of subarrays.

InvincibleMan
Автор

bro this was bomb of a video. gold content really!

aravindsingh
Автор

gajab bhaiya 🔥🔥 very helpful content

TechWek
Автор

I think we can do this sum using sliding window technique also.

DK-jscz