1
00:00:00,110 --> 00:00:01,220
Welcome back.

2
00:00:01,220 --> 00:00:06,710
In this video, let's get started with another interesting coding interview question, which is called

3
00:00:06,710 --> 00:00:09,710
the longest palindromic subsequence question.

4
00:00:10,100 --> 00:00:19,370
The question reads given a string s, find the longest palindromic subsequence length in S, so we are

5
00:00:19,370 --> 00:00:25,010
asked to find the length of the longest palindromic subsequence in a string, which is given to us,

6
00:00:25,010 --> 00:00:29,330
and the question then goes on to define what a subsequence is.

7
00:00:29,330 --> 00:00:37,580
So a subsequence is a sequence that can be derived from another sequence by deleting some or no elements

8
00:00:37,580 --> 00:00:41,030
without changing the order of the remaining elements.

9
00:00:41,030 --> 00:00:44,900
Okay, and then it says string s will have at least one character.

10
00:00:44,900 --> 00:00:50,810
So this means that we don't need to explicitly ensure that our code does not fail if we are given a

11
00:00:50,810 --> 00:00:52,160
string of length zero.

12
00:00:52,160 --> 00:00:55,760
So that's not going to happen because it's mentioned in the question.

13
00:00:55,760 --> 00:00:58,220
And again we are also given an example over here.

14
00:00:58,220 --> 00:01:00,890
If this is the string s which is given to us.

15
00:01:00,890 --> 00:01:06,950
Notice that if we delete these two characters and we are allowed to delete characters as per the definition

16
00:01:06,950 --> 00:01:08,450
of a subsequence given over here.

17
00:01:08,450 --> 00:01:14,420
So if we do that, we are left with a string that is, pee pee pee pee.

18
00:01:14,420 --> 00:01:17,030
And this is a palindrome of length four.

19
00:01:17,030 --> 00:01:22,970
And that's why the expected output, if this is the string s given to us, is equal to four.

20
00:01:22,970 --> 00:01:24,410
So this is the question at hand.

21
00:01:24,410 --> 00:01:31,400
We will be given a string s, and we have to identify the length of the longest palindromic subsequence

22
00:01:31,400 --> 00:01:34,100
that we can form from the given string.

23
00:01:34,100 --> 00:01:38,900
In the next video, let's discuss what approach we can take to solve this question.
