Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Oh, right, right, right.
Welcome back, ladies and gentlemen, ladies and gentlemen, welcome back.
Welcome back.
And in this video, we are going to talk about power in Rome while in Rome.
So these palindrome, what it is, what it what's this palindrome is all about?
What is all about?
So basically saying palindrome, palindrome without E or within.
Let me check it out.
Is a palindrome with or without D within.
With E with E.
Right.
Let's see.
Let's see.
Let's see.
Palindrome.
Awesome.
So basically palindrome is just it can be a word, the a phrase OK, which is a sequence of some digits
or characters.
And if you read it from the left to the right, OK, it should be the same as you read it from the right
to the left.
So in our case, in our case, if we will take a look, it's like, I don't know, erase it since we
worked with a race.
So let's say one, three, two, three, one.
And if we read this array from left to right, we will see that there was one, three, two, three,
one.
And if we read this array from the right to the left, we will see like one, three, two, three,
one, which is the same.
OK, so we will see in this case that this array is palindrome.
OK, so if you read from left to the right and if you read from their right to the left and you get
like the same things, then this array basically is palindrome.
So, yeah, so are the array.
Size may also be of an even size and it may also be of an odd size.
OK, so actually I don't think it really matters.
So let's say one, one, two, three, three to one.
So this array will be also a palindrome and basically it will take like a three like this one four six
two.
Then this array is absolutely not a palindrome palindrome.
But these two are palindromes.
The first one is of an odd size or a.
And the second one is of a and even sizably.
OK, good.
So what we have to do is to write a simple program, OK?
We program the prints and the checks out and prints if given a raise, a palindrome.
So or write down write a program that checks and prints if a given array.
He's a palindrome or not.
OK, so that's how are what we need to do.
And with that being said, let us start working.
So, first of all, let's create an array of some size.
Doesn't really matter.
And we know that basically, guys, what do you think what do you think is the best idea to solve this
kind of problem, this kind of exercise?
So there are a couple of options.
OK, a couple of options.
The first option is like to find some reason before you actually start solving it in one of the questions,
what what should be the condition?
So basically, we understand that probably all the elements of this, we will need to be checked, like
they will need to be at least to check that if we read it from left to right or from right to left,
then we need to check it.
So what I suggest us to do is to see the following pattern.
If you will, take a look at the leftmost element.
And here in the rightmost, they should be identical, since if you read from left to right, that will
be the first element.
And if you read from right to left, that should be also the first element.
And if we assume that these arrays should be a palindrome, then both of these values should be the
same.
And then if we take this value, the second value on the left and the second value on the right, we
should they also should be the same, since they are the second value in the reading sequence for both
of them.
So that's why they also should be the same.
And if we take a look at this even size array, then we know that, OK, we reached the middle ground,
no problem.
And if we have like an outsize array, then we know that if we reach some point when we have like one
value in the middle, so that definitely that's a palindrome since it five equals to five, if you read
it from left or if you read it from right, doesn't really matter.
OK, so, um, yeah, so that's basically would be our main logic behind this exercise, let's start
solving it.
So let's create I don't know, I let's start iterating over all the elements.
So for I equals to zero as long as I is less than less than what?
What do you think should be the condition here?
What do you think?
Should we simply leave it like i's less than size.
I plus.
Plus.
Well, I mean, maybe OK, but it also may for some scenarios that do not work.
So what I suggest this to do is to just make it beautiful.
OK, what I suggest this to do is to understand that we will need to simply compare and run these for
a loop until we reach the middle of the array, because there is no reason to continue checking out
after we've passed the middle.
Because the values are basically the same.
So as long as I is less than size divided by two, then in this case we will ask the following condition.
What will be the condition?
So the condition should be something like this, if you are in decline, meaning reading the value from
the left does not equal to ARRL in the exercise minus one minus.
I write because we read it from the right.
And if basically they are not the same, then it's basically I suggest you do take a look at this on
this operation, like we are looking for at least a pair of elements that will not satisfy the condition
of the quality.
And then we will be able to assume and to basically say that this array is not a palindrome.
So if that's the case, then maybe we should also, like I don't know, maybe we should also keep a
flag like a flag equal to one.
And we will assume that this flag says that.
We assume we assume that the array that the array a palindrome.
That's our assumption.
And if the array index does not equal to an array its size minus one minus sign, meaning the the element.
From the left side.
Does not equal.
To the element.
On the right side, then, definitely it means that the array, OK, is not he's not of.
He's not a palindrome, and then we can see, like flag equals zero and basically let's break from this
for a loop and then we come back to this place and we ask the following if flag equals to zero or basically
if it's the one so pretty def.
Printout of the array is a palindrome.
Otherwise, they'll see flat sales flying close to zero in this case, what we have to print is simply
print out.
The array is not a palindrome.
OK, so that's basically it for how you should solve it.
Now, let's simply take a look at executing one or two examples.
So previously we said like, let's take a look at this one first example.
Let's use size equals to at least one, initialize it and now build and run it.
And this array is palindrome.
And let's try the second example to make sure that it's also a palindrome.
Builder Ron, what happened?
I'm sorry, sorry, what's going on?
One second.
And we can basically see that we have here the phrase not a palindrome.
So why is that?
Oh, here it is.
The problem is, since we define size to be of size five, any tier of size six, so let's simply redefine
the size to six and rebuild it.
And let's see, the array is a palindrome, so now we can keep on moving.
And finally, let's take the last break here and go like this and also change the size before and build
their run.
And finally, the solution is come.
And the array is not a palindrome.
Yeah, I think I lost it.
Yeah.
So this is it for this video, guys.
I hope you like it.
Try to execute it also on your own today, tomorrow just to practice and to make sure you understand
each and every one of the concepts and things that were discussed here.
Of course, there are additional options to solve this exercise.
Try them also compare your results, see if it works, make sure that you understand everything that
you use, erase conditions and so on and so forth.
Thank you so much for watching.
My name is Lot.
This is Alphatech.
Leave some review.
Let me know what you think of the course so far and until next time.
I'll see you then.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.