Leetcode 1438 (Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit)

preview_player
Показать описание


Basic template to use when solving sliding window

Step1: Use some data-structure that can help you maintain constraint imposed by the problem while increasing or decreasing size of window.
Step2: Have a while loop inside, keep moving rightPtr until either you are at end or the constraint of the problem are meet, move leftPtr as soon as constraint aren't met.
Step3: Keep updating your maxvalue with maxWindowSize as long as constraints are being met.

Similar quesitons

Рекомендации по теме
Комментарии
Автор

which software are using to draw on desktop ?

kshitijsabale
join shbcf.ru