Subarray Product Less Than K - Leetcode 713 - Python

  Рет қаралды 13,080

NeetCodeIO

NeetCodeIO

Күн бұрын

🚀 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/problems/subarra...
0:00 - Read the problem
0:30 - Drawing Explanation
8:00 - Coding Explanation
leetcode 713
#neetcode #leetcode #python

Пікірлер: 80
@NeetCodeIO
@NeetCodeIO 3 ай бұрын
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.
@spsc07
@spsc07 3 ай бұрын
is your mouse acceleration on?
@NeetCodeIO
@NeetCodeIO 3 ай бұрын
I dont think so edit: actually yes it is
@blakewen4265
@blakewen4265 3 ай бұрын
what software do you use to draw?
@varunpenumudi
@varunpenumudi 3 ай бұрын
What software do you use for drawing?
@spsc07
@spsc07 3 ай бұрын
i guess Windows Whiteboard or something like that@@varunpenumudi
@joelmendez9616
@joelmendez9616 3 ай бұрын
I’d prefer no cam, just to be able to focus better, especially since there is a disparity in light
@ragilr1
@ragilr1 3 ай бұрын
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
@kebab4640
@kebab4640 3 ай бұрын
Woah, I said the same thing.
@huyennguyenmaingoc468
@huyennguyenmaingoc468 2 ай бұрын
Yes I felt the same thing. Glad you shouted this out XD
@user-j5ja95
@user-j5ja95 3 ай бұрын
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 ❤
@dingus2332
@dingus2332 3 ай бұрын
Yeah , agree to that
@ashersamuel958
@ashersamuel958 3 ай бұрын
Same here too. Love your content ❤
@chien-yuyeh9386
@chien-yuyeh9386 3 ай бұрын
Really happy to see you here again!🎉
@krishnavamsi9326
@krishnavamsi9326 3 ай бұрын
I prefer videos with face. It's good seeing you explaining . Big fan, been following you since 1 and a half years.
@walkastray007
@walkastray007 3 ай бұрын
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..
@SC2Edu
@SC2Edu 3 ай бұрын
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.
@gauravsharma-lu4if
@gauravsharma-lu4if 3 ай бұрын
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
@MP-ny3ep
@MP-ny3ep 3 ай бұрын
Great explanation as always. Thank you
@CS_n00b
@CS_n00b 3 ай бұрын
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)
@chisomedoka401
@chisomedoka401 3 ай бұрын
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
@KunalSharma-tf3kk
@KunalSharma-tf3kk 3 ай бұрын
very helpful your videos are...
@massimomonticelli6010
@massimomonticelli6010 3 ай бұрын
Hey NeetCode, I like the camera view!
@viizualares6890
@viizualares6890 3 ай бұрын
W NeetCode as always. I don't think you have ever missed once.
@sri_harsha_dv
@sri_harsha_dv 3 ай бұрын
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.
@user-rv1bx8hx4v
@user-rv1bx8hx4v 3 ай бұрын
Thank you!
@adnanmurtaza6914
@adnanmurtaza6914 3 ай бұрын
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.
@prashanthkumar0
@prashanthkumar0 3 ай бұрын
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
@hristianiliev7979
@hristianiliev7979 3 ай бұрын
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.
@rvishwakarma94
@rvishwakarma94 Ай бұрын
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
@azharuddinkhan1865
@azharuddinkhan1865 3 ай бұрын
Facecam is great addition. It provides classroom feeling and easy to understand with facial gesture
@romannikiforov5122
@romannikiforov5122 3 ай бұрын
I was struggling with this problem couple of weeks ago and was upset to know that you didn't have video on it.
@yang5843
@yang5843 3 ай бұрын
Interested in seeing how the feedback for cam-on videos will be!
@spsc07
@spsc07 3 ай бұрын
W man, W Webcam I would love to see this I was just doing this question !!
@satyamjha68
@satyamjha68 3 ай бұрын
Solved it!!
@AdityaBhongade
@AdityaBhongade 3 ай бұрын
Hey NeetCode, your content is great. It would be better if you increase the audio.
@sidhartheleswarapu
@sidhartheleswarapu 3 ай бұрын
Why l
@ahmedhamed1154
@ahmedhamed1154 3 ай бұрын
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]
@arunmurugan7093
@arunmurugan7093 3 ай бұрын
I was gonna do the daily today and just saw your upload. I guess ill be back here in 1 hour. 😅
@art4eigen93
@art4eigen93 3 ай бұрын
will this work for negative values too?
@akshaychavan5511
@akshaychavan5511 3 ай бұрын
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
@Akhillbj
@Akhillbj 3 ай бұрын
For loop is better, sometimes you still forget to increment p2 , most might not , just in case! You never know
@akshaychavan5511
@akshaychavan5511 3 ай бұрын
@@Akhillbj I agree. Will keep this in mind.
@inderlalchandani
@inderlalchandani 3 ай бұрын
Nice
@JSH1994
@JSH1994 15 күн бұрын
cam or no cam it doesn't bother me :) thank you for your work
@ankandebnath1056
@ankandebnath1056 3 ай бұрын
bro keep doing the daily challenges
@tokkiM3
@tokkiM3 3 ай бұрын
I like the face cam, keep up the good work.
@isseihyodou7111
@isseihyodou7111 3 ай бұрын
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
@dingus2332
@dingus2332 3 ай бұрын
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 ??
@tommyshelby6277
@tommyshelby6277 3 ай бұрын
with face cam op!
@ZeckTTV
@ZeckTTV 3 ай бұрын
I like having the camera on, I feel like you do a better job explaining your throught process with it on.
@juuzousuzuya69
@juuzousuzuya69 29 күн бұрын
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.
@user-ty7og3rd4z
@user-ty7og3rd4z 3 ай бұрын
I definetly like the videos with face cam!
@chien-yuyeh9386
@chien-yuyeh9386 3 ай бұрын
🎉🎉🎉🎉🎉
@ronbuchanan5432
@ronbuchanan5432 3 ай бұрын
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
@ShashiKanthvarma-lb6xb
@ShashiKanthvarma-lb6xb 3 ай бұрын
Binary search is very hard to think about
@pepe-pj9wr
@pepe-pj9wr 3 ай бұрын
WE LOVE THE CAM ON!
@m.kamalali
@m.kamalali 3 ай бұрын
Hhh , i did the exact same code only difference i used p instead of product
@slambam4592
@slambam4592 3 ай бұрын
Without facecam. Feel it can be too distracting
@alicenNorwood
@alicenNorwood 3 ай бұрын
I prefer with cam
@ttowe
@ttowe 3 ай бұрын
better with camera
@kz_cbble9670
@kz_cbble9670 3 ай бұрын
No camera preffered! Keep camera on in story or other videos
@yang5843
@yang5843 3 ай бұрын
Java Solution class Solution { public int numSubarrayProductLessThanK(int[] nums, int k) { int prev = 1; int rc = 0, i = 0; for (int j=0;j
@expeditiontoabyss3597
@expeditiontoabyss3597 3 ай бұрын
i was shocked that I couldn't find a solution this morning in your channel. But now its here, probably some race condition.
@ignsock2915
@ignsock2915 3 ай бұрын
i love you
@edmonddantes587
@edmonddantes587 3 ай бұрын
god damnit I was a gnat's c*nt hair away from a working solution. Thanks for the vid, bro
@kahafb
@kahafb 3 ай бұрын
Like the facecam
@nirmalgurjar8181
@nirmalgurjar8181 3 ай бұрын
I cant see your bag on the floor, so no point in keeping camera :P
@krateskim4169
@krateskim4169 3 ай бұрын
Face cam is good
@pastori2672
@pastori2672 3 ай бұрын
you look so cute bro 🥰
@MikeTypes
@MikeTypes 3 ай бұрын
It’s better to have your face on
@dipakrajbhar2723
@dipakrajbhar2723 22 күн бұрын
Are you Indian
@kebab4640
@kebab4640 3 ай бұрын
I like it but your jawline makes you look so handsome that you distract me 😍
@zweitekonto9654
@zweitekonto9654 3 ай бұрын
Definitely dont like the face cam. Just because it takes up screen space and serves absolutely no purpose.
@shakibrahman
@shakibrahman 3 ай бұрын
sorry you're too handsome it's distracting me
@tanishqbhatt9619
@tanishqbhatt9619 3 ай бұрын
No offense to you, but I'd prefer videos without a face cam
@PickNick50
@PickNick50 3 ай бұрын
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.
@tanish5662
@tanish5662 3 ай бұрын
no face please
Subarrays with K Different Integers - Leetcode 992 - Python
17:31
Minimum Cost to Hire K Workers - Leetcode 857 - Python
19:01
NeetCodeIO
Рет қаралды 12 М.
ИРИНА КАЙРАТОВНА - АЙДАХАР (БЕКА) [MV]
02:51
ГОСТ ENTERTAINMENT
Рет қаралды 10 МЛН
БОЛЬШОЙ ПЕТУШОК #shorts
00:21
Паша Осадчий
Рет қаралды 8 МЛН
The child was abused by the clown#Short #Officer Rabbit #angel
00:55
兔子警官
Рет қаралды 23 МЛН
Distribute Coins in Binary Tree - Leetcode 979 - Python
17:41
NeetCodeIO
Рет қаралды 14 М.
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 553 М.
Score After Flipping Matrix - Leetcode 861 - Python
22:30
NeetCodeIO
Рет қаралды 9 М.
Arranging Coins - Leetcode 441 - Python
12:53
NeetCode
Рет қаралды 33 М.
Reveal Cards In Increasing Order - Leetcode 950 - Python
11:14
NeetCodeIO
Рет қаралды 14 М.
8 patterns to solve 80% Leetcode problems
7:30
Sahil & Sarra
Рет қаралды 221 М.
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 298 М.
Maximum Sum Circular Subarray - Leetcode 918 - Python
16:49
NeetCodeIO
Рет қаралды 28 М.
ИРИНА КАЙРАТОВНА - АЙДАХАР (БЕКА) [MV]
02:51
ГОСТ ENTERTAINMENT
Рет қаралды 10 МЛН