Leetcode - Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

5:16 you mean greater than one, anyway great explanation!

aishwat
Автор

Amazing solution. I learned something new. Thank you Sir 😄

I know "sliding window" plus a "Hash" and a " counter" can be used to find longest subarray with k distinct elements

Now you taught me that sliding window plus "min" and "max" deque can be used to find longest window with absolute difference less than k

alexnice
Автор

I love that min and max queue technique with the sliding window.

Also that deque technique is also used when finding the max or min value in each subarray of size K in an array O(n) time

alexnice
Автор

Why time complexity of deletion considered to be O(1) for deleting multiple elements from the deques. What if there are N elements to removed from the deque?

AnshMehtaGR
Автор

Can we use set we insert into set begin () will give smallest and end()-1 will give maximum

dailymemes
Автор

No logical flow of thought process. Deques just pop up out of nowhere. Where is the recurrence relation?

Siddharthpratapsingh
Автор

Awesome explanation. Make more videos like this

DiaryOfMuhib
Автор

What will your algorithm output for this input [10, 1, 2, 1, 7, 2] for k=5
It will be 4, which is wrong.

dhanushr
Автор

so sliding window kind of approach basically

code
Автор

in the first explanation, if we take input [4, 8, 5, 1, 7, 9] ur output is 6 but excepted is 3. u r comparing only with min and max elements.

akhilkumaramarneni
Автор

thanks for the solution. really good explanation.

ShwetaSingh-ypok
Автор

This question was asked in Facebook screening round

testbot
Автор

Hye bro. Good video. Enjoyed it. Pls keep making more such videos.

yuganderkrishansingh
Автор

bhaiya what if we use stack for min and max element

yashgupta-fkzc
Автор

we can actually use two variables for min and max

pvchio
welcome to shbcf.ru