Smallest subarray with sum greater than x🔥 | Array | Love Babbar DSA Sheet | Hindi
Vložit
- čas přidán 9. 07. 2024
- Time Stamps :
Problem discussion : 0:00
Approaching the problem : 02:10
Dry Run Algorithm : 02:26
Algorithm discussion : 05:40
Code explanation : 07:32
Time Complexity Discussion : 08:40
Time Complexity : O(n)
Space Complexity : O(1)
Problem Link : practice.geeksforgeeks.org/pr...
C++ Code Link : github.com/Ayu-99/Love-Babbar...
Python Code Link: github.com/Ayu-99/Love-Babbar...
Love Babbar DSA Sheet : drive.google.com/file/d/1FMdN...
Please like, share and subscribe if you found the video useful. Feel free to ask in comments section if you have any doubts. :)
#DataStructuresAndAlgorithms
#LoveBabbarDSASheet
#interviewpreparation
Smallest subarray with sum greater than x solution
Smallest subarray with sum greater than x Leetcode
Smallest subarray with sum greater than x C++
Smallest subarray with sum greater than x C++ Hindi
Smallest subarray with sum greater than x Hindi
Checkout the series: 🔥🔥🔥
👉 Array: • Arrays
👉 Recursion : • Recursion
👉 Stack and Queue : • Stack And Queue
👉 Greedy : • Greedy
👉 Dynamic Programming : • Dynamic Programming
👉 Leetcode contests : • Leetcode contests
👉 Leetcode June Challenge : • Leetcode June Challenge
👉 Leetcode July Challenge : • Leetcode July Challenge
LIKE | SHARE | SUBSCRIBE 🔥🔥😊
way of teaching is mind-blowing God bless u, dear.
your videos are solving all my doubts,really thanks
Welcome Fatehpreet, glad they are helpful :)
best way of teaching
🤗🥹
You explain so well!!!
Thanks Garvita :)
You could use a sliding window technique.. It passed all test cases.. This is in JS
let left=0
let count=0
let res=Number.MAX_VALUE
for(let i=0;ix){
res=Math.min(res,i-left+1)
count-=a[left++]
}
}
return res
Thanks for sharing js code🙂
@@AyushiSharmaDSA you're welcome 🙂
@@johndoe-cq3de what the hell is 'x'
@@AyushiSharmaDSA is javascript code is allowed in interview? I don't think so.
@@biikaaa.6540 question mai dekh dhyan se bhai
You are doing such a great work thanks mam.
Thank you :). Keep supporting and please share with your friends and juniors :)
Outstanding
Thanks Ananya😊
Didi your voice is choooo chweet☺🥰🤗🖤
Thank you Arshad :)
Reach ++; 👍👍
Please also explain java code if possible, it will be very helpful
I will try :)
didnt got time complexity part
Mam Walmart ko ctc kitti hai
Dude you have to add 51+0 not 55+0 check it: 4:20
Why not 45 + 19 > 51 ? Why not [45, 19] can be the smallest sub aaray ?
No we can't do this because in question it is mentioned a subarray and subarray is continuous we can't choose random element subarray means a continuous part of array
if possible please explain code in java as well
I will try :)
didi time comlexity samajh nahi aye thoda sa help kar dijie na
if value not found it should return zero testcase failing dude
why we do not count while complexity? @ayushi
Didi ye video samajh nahi aayi . 1 baar aap is question ka dusri approach ya video bata sakti hain kya?
Your code will not run, if the test case is:
1 1
1
This test-case is the first test case at Date- 08/10/2022
Yes, we need to add another base case condition when we have a single element in the array. And if that element is greater than X, you will return 1 otherwise return 0.
Ekdam bekar 😢