Це відео не доступне.
Перепрошуємо.
Subarray Product Less Than K - Leetcode 713 - Python
Вставка
- Опубліковано 14 сер 2024
- 🚀 neetcode.io/ - A better way to prepare for Coding Interviews
🧑💼 LinkedIn: / navdeep-singh-3aaa14161
🐦 Twitter: / neetcode1
⭐ BLIND-75 PLAYLIST: • Two Sum - Leetcode 1 -...
Problem Link: leetcode.com/p...
0:00 - Read the problem
0:30 - Drawing Explanation
8:00 - Coding Explanation
leetcode 713
#neetcode #leetcode #python
Yes I use a mouse to draw, in case you still don't believe me. Why? Because with a mouse you can artificially lower the DPI, such that I have to move my hand a few inches to move the mouse cursor by a single inch. This means I can be more precise than if i were using a pen.
is your mouse acceleration on?
I dont think so
edit: actually yes it is
what software do you use to draw?
What software do you use for drawing?
i guess Windows Whiteboard or something like that@@varunpenumudi
Really happy to see you here again!🎉
Big fan of your work. Would like the earlier format without face. A lot of attention goes to your handsome face than looking at the explanation drawings
Woah, I said the same thing.
Yes I felt the same thing. Glad you shouted this out XD
I’d prefer no cam, just to be able to focus better, especially since there is a disparity in light
Hey Neetcode I love your channel and love you and you're super handsome but personally I find having camera on leetcode video to be a bit distracting so I prefer no camera. Nothing personal, I can just focus on content better without camera ❤
Yeah , agree to that
Same here too. Love your content ❤
Great as usual.
I approached it correctly with a sliding window method, but I used slices and I was not using the difference between indices. Great intuition, thanks.
Hey I really appreciate your consistency on posting videos. Also I like the webcam, now we can see your reaction to the problems as you are explaining them to us. Makes it feel like you're human after all..
I prefer videos with face. It's good seeing you explaining . Big fan, been following you since 1 and a half years.
i have been watching your channel for a while now, you are helped me a lot with learning dsa . keep the camera on . i like it this way
Here is a better way to understand why getting all subsequences is O(n^2):
First element needs n operations to get all n subarrays, n-1 for second etc...
We are summing over numbers from n to 1
This can be thought of as a discretization of the integral of x from 0 to n
this is 0.5*n^2 ~ O(n^2)
Hey NeetCode, I like the camera view!
Great explanation as always. Thank you
The facecam makes the video feel more personable. I can see how it can be distracting, but I think it brings in more value than it takes away.
NEETly explained! Thank you so much :D
def numSubarrayProductLessThanK(self, nums: List[int], k: int) -> int:
res = 0
p1, p2 = 0, 0
currentProd = 1
while p2
For loop is better, sometimes you still forget to increment p2 , most might not , just in case! You never know
@@Akhillbj I agree. Will keep this in mind.
I almost had the solution for this problem and I identified the part where we are missing to count the array [5], but I did not know how to prove how many new subarrays that satisfy the condition we are adding on every correct step. I even went looking for variant formula and combinatorics. Who knew that such a simple observation with the equation is the answer.
I tried to do it with queue instead of sliding window. Despite being O(n) memory solution, the submission passed pretty efficiently. Thanks for O(1) solution. I personally like video with cam included.
Bro, your consistency level is off the roof. I’m literally finding it hard to understand why you still leetcoding you already got it all
Facecam is great addition. It provides classroom feeling and easy to understand with facial gesture
Today's daily problem question ,
i was searching this with every possible filter to get a solution video from neetcode 😂
Finally its here...
I didn't get (r-l+1) logic in other's code ...
now its clear why
Thank you
I believe the total number of contiguous subarray is not just n^2. It is n + (n-1)+ (n-2) .....+1 = [n*(n+1)]/2 . So for array of size 4 the total number of contiguous subarrays will be 4+3+2+1 = 10 and not n^2 = 16
W NeetCode as always. I don't think you have ever missed once.
Why l
Another solution
We can desfine int nxt[N] such that nxt[i] is the next element to the right not equal to 1
and for each pos i, we can show that the maximum number of jumps is log2(k) which is about 20 jumps
int mult=1;
int j=i;
while(j is not out of the range && mult*a[j]
cam or no cam it doesn't bother me :) thank you for your work
I was struggling with this problem couple of weeks ago and was upset to know that you didn't have video on it.
very helpful your videos are...
Hey NeetCode, your content is great. It would be better if you increase the audio.
W man, W Webcam I would love to see this I was just doing this question !!
Interested in seeing how the feedback for cam-on videos will be!
bro keep doing the daily challenges
I was gonna do the daily today and just saw your upload. I guess ill be back here in 1 hour. 😅
Thank you!
WE LOVE THE CAM ON!
I understand the solution , but want to know , why we could not use DP here ? , also like Subarray Sum Equals K , why we were not able to use prefixSumDiff to count map ??
Hey, Neet love your videos man, would love to see the video more focused on the solution, a lot of attention goes on to your handsome face :D
I like the face cam, keep up the good work.
Solved it!!
I definetly like the videos with face cam!
Java Solution
class Solution {
public int numSubarrayProductLessThanK(int[] nums, int k) {
int prev = 1;
int rc = 0, i = 0;
for (int j=0;j
Nice
I like having the camera on, I feel like you do a better job explaining your throught process with it on.
will this work for negative values too?
with face cam op!
Binary search is very hard to think about
I prefer with cam
there is no way I would think this solution in 1 go, I might know it will be a sliding window problem but the logic behind right - left + 1 would result to counting the subarray? I wont be able to guess or think of it lol.
Without facecam. Feel it can be too distracting
It's good to see you, don't get me wrong but it also has got me distracted because I want to focus on what you're doing but at the same time you kinda want to glance to the face that talks
better with camera
No camera preffered!
Keep camera on in story or other videos
Hhh , i did the exact same code only difference i used p instead of product
god damnit I was a gnat's c*nt hair away from a working solution. Thanks for the vid, bro
Like the facecam
i was shocked that I couldn't find a solution this morning in your channel. But now its here, probably some race condition.
🎉🎉🎉🎉🎉
i love you
Face cam is good
you look so cute bro 🥰
I cant see your bag on the floor, so no point in keeping camera :P
It’s better to have your face on
sorry you're too handsome it's distracting me
Are you Indian
Definitely dont like the face cam. Just because it takes up screen space and serves absolutely no purpose.
Please no face cam bro, I come here to study and seeing anyone's face is not gonna help me to learn more. And I low key respect those who maintains anonymity.
I like it but your jawline makes you look so handsome that you distract me 😍
No offense to you, but I'd prefer videos without a face cam
no face please