filmov
tv
Longest Turbulent Subarray | dynamic programming | leetcode# 978

Показать описание
Welcome to Joeystech and in this video, we will be solving a problem from the Leetcode website - the longest turbulent subarray.
Like its name, this problem will create a little turbulence in the mind while you try to solve it but like I say, if your foundation is strong then solving it is going to be not that difficult.
You are about to add a fabulous dynamic programming problem to your bag so stay tuned to the video and watch it till the end.
The solution that I am going to tell you passed all the test cases in Leetcode and it took only 3 milliseconds.
Also, if you haven’t subscribed to my channel yet, hit the subscribe button and the bell icon because that way you will get to know whenever I release a new video.
Now, I invite you to the section where I explain the problem statement to you without further delay.
You have an integer array out of which you need to find the longest turbulent subarray.
9,4,2,10,7,8,8,1,9
A turbulent subarray is a subarray in which the comparison sign turns opposite between each contiguous pair of integers in the subarray.
Remember that the comparison sign flips between the integers.
Out of the array given above, we have to find the longest such subarray that is turbulent in nature.
Let’s begin solving it and see how the dynamic programming technique unfolds the solution magically.
*********** Github link **************
Like its name, this problem will create a little turbulence in the mind while you try to solve it but like I say, if your foundation is strong then solving it is going to be not that difficult.
You are about to add a fabulous dynamic programming problem to your bag so stay tuned to the video and watch it till the end.
The solution that I am going to tell you passed all the test cases in Leetcode and it took only 3 milliseconds.
Also, if you haven’t subscribed to my channel yet, hit the subscribe button and the bell icon because that way you will get to know whenever I release a new video.
Now, I invite you to the section where I explain the problem statement to you without further delay.
You have an integer array out of which you need to find the longest turbulent subarray.
9,4,2,10,7,8,8,1,9
A turbulent subarray is a subarray in which the comparison sign turns opposite between each contiguous pair of integers in the subarray.
Remember that the comparison sign flips between the integers.
Out of the array given above, we have to find the longest such subarray that is turbulent in nature.
Let’s begin solving it and see how the dynamic programming technique unfolds the solution magically.
*********** Github link **************
Комментарии