Amazing content on solving subarray sum problems for any given k! 💖💖💖 This channel deserves millions of views. The explanations are spot on, building the approach step-by-step from the basics to more challenging cases. Truly grateful for the effort in making complex concepts so accessible. Thank you so much! ❤❤❤
static ArrayList subarraySum(int[] arr, int target) { // code here int sum = 0; int j = 0; ArrayList list = new ArrayList(); for (int i = 0; i < arr.length; i++) { if (sum < target) { sum += arr[i]; } while (sum >= target) { if (sum == target) { list.add(j + 1); list.add(i+1); return list; } sum -= arr[j]; j++; } } list.add(-1); return list; } 2nd pattern solution hai bhaiya without using HashMap..🙂☺☺
Sir iss java DSA ki playlist main 1000 + questions kar va do....jiss ko karne K baad Kuch aur na karna pade Iss playlist karne k baad Seedha Amazon aur Flipkart nikal jaye
vector check(vector&v, int n, int k) { vectortemp; temp.push_back(-1); unordered_mapmp; mp.insert({0, -1}); //x==k int sum = 0; for (int i = 0; i < n; i++) { sum += v[i]; if (mp.count(sum - k)) { temp[0] = mp[sum - k] + 2; temp.push_back(i + 1); break; } mp.insert({sum, i}); } return temp; } this code is getting tle in geeks for geeks don't know why at tcs 1073 even if i am using the unordered_map same its getting tle at 1019
its giving error on gfg for Find Indexes of a subarray with given sum problem my code is ArrayListlist = new ArrayList(); list.add(-1); HashMapmp = new HashMap(); mp.put(0,-1); int sum =0; for(int i =0;i
Hello Bhaiya, Please aap cheatsheet de sakte hai ki kon kon se question puche jate hai FANG company, actually maine aaj hi aapki 1st video dekhi hai DSA+Java wali aur uss playlist ko apne pass save bhi kar li hai but bhaiya main job dhund rha hun toh aisa kuch possible hai ki mostly whi questions DSA ke puche aur main crack kar jaun kyoki aapko bhi pta hai company main DSA ki demand hai aapki playlist toh dekh hi rha hun par job abhi se achi mil jaye toh acha hoga, hope aap samjh gye honge main kya khena chah rha hun iss DSA ki wajah se mujhe job ki bhut tension, please help
One of the best TH-cam channel for learning DSA... thankyou so much Bhaiya ❤❤❤
Nice explanation sir
Very nice explanation
Sir, Loved the way you explained... after 2 months my placements are going to start and your DSA Vids are helping a lot thank you
Mine too sath me preparation kre kya?
bhai bhaut bhaut pasand aayi video.. bhaut bdiya dost 🙂
Pushing the algorithm
Amazing content on solving subarray sum problems for any given k! 💖💖💖 This channel deserves millions of views. The explanations are spot on, building the approach step-by-step from the basics to more challenging cases. Truly grateful for the effort in making complex concepts so accessible. Thank you so much! ❤❤❤
🙌🙌
m jaldi jaldi ise finish kar rha hu taki bad m sath sath aajau aapke and thanks a lot for this awesome content sir
Nyc Explanation
Please start the Tree series soon..
static ArrayList subarraySum(int[] arr, int target) {
// code here
int sum = 0;
int j = 0;
ArrayList list = new ArrayList();
for (int i = 0; i < arr.length; i++) {
if (sum < target) {
sum += arr[i];
}
while (sum >= target) {
if (sum == target) {
list.add(j + 1);
list.add(i+1);
return list;
}
sum -= arr[j];
j++;
}
}
list.add(-1);
return list;
} 2nd pattern solution hai bhaiya without using HashMap..🙂☺☺
🥰🥰🥰🥰🥰🥰🥰🥰
Awesome😍
Sir iss java DSA ki playlist main 1000 + questions kar va do....jiss ko karne
K baad
Kuch aur na karna pade
Iss playlist karne k baad
Seedha Amazon aur Flipkart nikal jaye
tu direct CEO banega vi
vector check(vector&v, int n, int k) {
vectortemp;
temp.push_back(-1);
unordered_mapmp;
mp.insert({0, -1}); //x==k
int sum = 0;
for (int i = 0; i < n; i++) {
sum += v[i];
if (mp.count(sum - k)) {
temp[0] = mp[sum - k] + 2;
temp.push_back(i + 1);
break;
}
mp.insert({sum, i});
}
return temp;
} this code is getting tle in geeks for geeks don't know why at tcs 1073 even if i am using the unordered_map same its getting tle at 1019
it is showing TLE in GFG now after writing exact same code in Subarray with given sum
Can you share problem link?
@@shashwat_tiwari_st now it's working thanks a lott for video and reply
its giving error on gfg for Find Indexes of a subarray with given sum problem my code is
ArrayListlist = new ArrayList();
list.add(-1);
HashMapmp = new HashMap();
mp.put(0,-1);
int sum =0;
for(int i =0;i
sub array with given sum is giving TLE
Sir please questions direct leetcode ya fir GfG pe solve kar diya kariye please sir inteli j idea. Se nahi please
Hello Bhaiya,
Please aap cheatsheet de sakte hai ki kon kon se question puche jate hai FANG company, actually maine aaj hi aapki 1st video dekhi hai DSA+Java wali aur uss playlist ko apne pass save bhi kar li hai but bhaiya main job dhund rha hun toh aisa kuch possible hai ki mostly whi questions DSA ke puche aur main crack kar jaun kyoki aapko bhi pta hai company main DSA ki demand hai aapki playlist toh dekh hi rha hun par job abhi se achi mil jaye toh acha hoga, hope aap samjh gye honge main kya khena chah rha hun iss DSA ki wajah se mujhe job ki bhut tension, please help
You can check my java dsa sheet. Usme frequently asked dsa questions arranged h topic wise.
@@shashwat_tiwari_st can you please give the link maine playlist main check kiya mujhe mil nhi rha hai
@@BlendBox check description of this video
th-cam.com/video/lZ5olZxEt_s/w-d-xo.htmlsi=G5oTmmb5U9l5ZSRl