Leetcode BiWeekly contest 108 - Easy - Longest Alternating Subarray

preview_player
Показать описание
In this video we discuss the first problem of Leetcode BiWeekly contest 108

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

This is O(n^2)time O(1)space solution. I have done in O(n)time O(n)space.😅 didn't see the constraints 😅😅

SohanKale-mz
Автор

Hi Prakhar, excellent explainantion as all ways!!!
I had a doubt regarding one test case for this question

[14, 30, 29, 49, 3, 23, 44, 21, 26, 52]
Output:
2
Expected:
-1

Should not be the answer for this test case be 2? because there exists a subarray with [30, 29] which has a difference 1 (similar to the second given test case)

HarishSumant