This is probably the best Leetcode channel on the internet. Thank you so much for the invaluable content. Your drawing explanations are gold!
@rongrongmiao30182 жыл бұрын
Please do a video on the follow up question of this question: what do we do if there are negative numbers in the array. Thanks.
@spirner6692 жыл бұрын
after watching so many problems done by u. For this problem i've came up with exactly the same solution
@nikhilvecha61922 жыл бұрын
Many thanks to you sir, you're actually helping a lot of people by solving these questions
@udaykulkarni56392 жыл бұрын
This guy is absolute Legend and has ability to make complicated problems look easy! Thanks man :) Keep up the good work.
@elvinjafarli62572 жыл бұрын
Much appreciated, the explanation is way better than any Leetcode solution provided.
@summisahani64152 ай бұрын
Probably the most precise explanation. Thanks a lot. Keep posting.
@studbud-qw3yo9 ай бұрын
i was kinda confused on why you were not using if statement thanks for clearing my doubt you are a legend
@metin4yt2 жыл бұрын
What would be the solution if there would be negative numbers in the array?
@yash-uy5ym4 ай бұрын
I thought this question had some trick in it but it's only a sliding window Great explanation ❤
@cutiex73572 жыл бұрын
Every time when I hear "Hi everyone welcome back" I'm excited!!!
@T3Deye2 жыл бұрын
mate you are not a real person
@saileshsriram3295 Жыл бұрын
This was a pretty complicated problem. Thanks a lot for helping me understand it.
@israaezzat23532 жыл бұрын
Really feel relaxed when i am looking for a solution of a problem on youtube and find your vedio ❤❤
@abhishekpawar84582 жыл бұрын
What a coincidence, I was just solving the same problem on Lintcode ! Thanks a lot for the upload, I have an upcoming google interview
@MistaT442 жыл бұрын
Best of luck
@edwythefair52152 жыл бұрын
Good luck!
@bhuppidhamii Жыл бұрын
lintcode?
@meirgoldenberg56385 ай бұрын
What do you make of the follow-up question, which asks us to come up with a worse solution that the sliding window one we already came up with?
@lingxu96972 жыл бұрын
Love you NC, best coding channel ever...
@slai2389 Жыл бұрын
Thank you, I was struggling to this question until I found your video
@anmolmittal56892 жыл бұрын
You are a good person, helping us in programming 😊. How do you build such algos ? Plz give us a path to stick to master DSA 🙏
@cfbf96 Жыл бұрын
When neet say things like: "well this is easy solution" or "this is just a standard xyz algo" just makes a dumbhead like me feel even dumber.
@RachelDong-y4sАй бұрын
expend right until success, shrink left until fail
@serene75605 ай бұрын
can we check if r-l+1= 1 inside the while loop and return 1 if that's the case?
@GenerationX1862 жыл бұрын
Love your videos. They're so helpful. Always leave more informed and with one more approach than before playing your video.
@hype-r307610 ай бұрын
What if the array contains all elements greater than the target then wouldn’t the time complexity run in O(n^2)?
@howardlam6181Ай бұрын
1590 is basically this problem but needs to be equal not greater than
@budiman-kr5ug8 ай бұрын
so many people are helped because of you
@jugsma66762 жыл бұрын
Thank you, This would be my approach: import sys def min_sub_array(target, nums): l = 0 r = 1 if target == nums[l]: return 1 total = nums[l] + nums[r] min_len = sys.maxsize while r >= l and r < len(nums): if total == target: min_len = min_len if min_len < r-l+1 else r-l+1 l = l+1 r = r+1 total = sum(nums[l:r + 1]) elif total > target: min_len = min_len if min_len < r-l+1 else r-l+1 l = l+1 total = sum(nums[l:r+1]) else: r = r+1 total = sum(nums[l:r+1]) min_len = 0 if min_len == sys.maxsize else min_len return min_len
@butoyighyslain1718 ай бұрын
I was thinking about an algorithm that would leverage sorting the nums in reverse order and I kinda feel like it could be possible
@balamurali89802 жыл бұрын
Can you please help in solving the question - 68. Text Justification. There is no explantation even in leetcode, please. Thank you so much for your valuable videos.
@akshaibaruah17202 жыл бұрын
This solution (optimized) was pretty easy to come up with. But can you make a video on the follow up of this question i.e. do it in O(nlogn)
@pradeepranjan13092 жыл бұрын
great... You makes coding fun
@shamanthsham5132 жыл бұрын
Isn't brute force solution's time complexity is O(n^2 logn) /O(n^3) ?
@ngneerin2 жыл бұрын
Beautiful solution
@leetcodeespanol592 жыл бұрын
Gracias por el video otra vez! Gran ayuda que esta poniendo en youtube!
@Nick-uo2bi2 жыл бұрын
Please create a playlist for DSA and DP in python beacause there isn't any on KZbin yet.....it will help thousand of ppl.
@6priyanshu2 жыл бұрын
my first comment ever on YT, you are an inspiration. please keep creating such awesome content !! you are helping community, thank you !
@adnanhowlader1432 жыл бұрын
daily one problem from your channel,,thats the challenge I took
@MISIUYT2 жыл бұрын
Solving this on my own took way too long :)
@nagendrabommireddi8437 Жыл бұрын
@neetcode sir .in this question follow up is to solve this by binary search....please help me to do using binary search...atleast please give a hint how we can solve using binarysearch..please
@aleksandrajovanovic26317 ай бұрын
how can we do this with one passage through array??
@user-ft1rj5jh3n2 жыл бұрын
Hi neetcode! Could you post a video on Knight Dialer? It would mean a lot! Thank youu
@setiyakitchen3 ай бұрын
what if the array contains negative too?
@procon42 жыл бұрын
Is there a faster approach where you start at the index of the largest number in the list rather than the first?
@zolopane1172 жыл бұрын
I don’t think that works. Imagine the input array in example 1 was [2, 3, 1, 2, 3, 4] instead (basically just swapping the last two elements). If you jumped to the largest element, you’d hit the end of the list before ever reaching the max. It’s possible to add a conditional to check both sides of the max, but that might run into issues if you had an input like this: [2, 3, 2, 1, 1, 4, 1]
@procon42 жыл бұрын
@@zolopane117 yeah I was thinking you’d expand outward from the largest item.
@weiyaoli69772 жыл бұрын
amazing! love it
@thepriestofvaranasiАй бұрын
How do you do it so easily dude. I spent hours clueless trying to come up with stupid solutions.
@trungduong82256 ай бұрын
hey thanks for the great video, but I'm having a problem. I implemented the similar idea with python then submit, but it got error with the input of [1,2,3,4,5]. It said expected "3" but I dont see any valid window with that size. Can anyone help, thanks!
@trungduong82256 ай бұрын
oh it's greater than or equal to
@waltairwhite8212 ай бұрын
@@trungduong8225 lol thanks dude.. i feel dumb now
@vijethkashyap151 Жыл бұрын
Can anybody help me with understanding the complexity of the solution coded here?
@taimurshah59562 жыл бұрын
What software do you use to draw? And how do you record it?
@plontulublalulu2 жыл бұрын
wait, they got rid of the "contiguous" part on the problem. Is it still contiguous?
@nikhil_a012 жыл бұрын
Yes, it's still contiguous. A subarray is by definition contiguous. You can test it on LeetCode too. If they accepted non-contiguous elements then the solution to nums = [5, 1, 2, 3], target = 7 should be 2. Because [5] and [2] sum to 7. But their expected answer is 3 because [5, 1, 2] is the only contiguous subarray that sums to >= 7.
@numberonep54042 жыл бұрын
Very nice content as usual :3 !!
@yashpathak92852 жыл бұрын
When are we getting a series for System Design ?
@NeetCode2 жыл бұрын
Hopefully next month!
@programming30432 жыл бұрын
Can anyone explain why its not O(n²)
@chenyan44442 жыл бұрын
Same question here.
@nikhil_a012 жыл бұрын
Why would it be O(N^2)? The right pointer iterates through the entire array doing O(1) work each time. That's O(N). And the left pointer also iterates through the entire array in the worst case, doing O(1) work each time. That's also O(N). So the overall time is O(N).
@12.aryankumar452 жыл бұрын
First here today ig. Thank you so much for these videos .
@faisalabdulkadir94392 жыл бұрын
Good day sir , I appreciate all the work u are doing , pls sir can u pls look at the increasing in order search tree question 897, I’m having a hard time understanding the recursion process used ,thank u sir
@vishwanathanr28512 жыл бұрын
How many problems you solve per day ❤️
@MISIUYT2 жыл бұрын
he said at least one, but sometimes more depending on the day.
@ghoshsuman94954 ай бұрын
any one wants to practise please comment
@iamburntout10 ай бұрын
Is this a joke. how am i supposed to come up with it during the interview. anyway, great video as always.
@thepriestofvaranasiАй бұрын
Practice. Do multiple sliding window problems and you'll be able to recognise the pattern. These are PHD level dissertations and you can't come up with your own if you haven't done similar problems before.
@yourcaremail5 ай бұрын
bruh we can almost hear you, please decrease your voice volume a bit more