All language subtitles for 3. Array - Palindrome Exercise

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,770 --> 00:00:02,820 Oh, right, right, right. 2 00:00:02,930 --> 00:00:07,790 Welcome back, ladies and gentlemen, ladies and gentlemen, welcome back. 3 00:00:07,820 --> 00:00:08,820 Welcome back. 4 00:00:08,910 --> 00:00:15,340 And in this video, we are going to talk about power in Rome while in Rome. 5 00:00:15,890 --> 00:00:22,820 So these palindrome, what it is, what it what's this palindrome is all about? 6 00:00:22,820 --> 00:00:23,750 What is all about? 7 00:00:24,230 --> 00:00:30,590 So basically saying palindrome, palindrome without E or within. 8 00:00:30,680 --> 00:00:32,150 Let me check it out. 9 00:00:32,510 --> 00:00:36,920 Is a palindrome with or without D within. 10 00:00:37,310 --> 00:00:38,780 With E with E. 11 00:00:38,780 --> 00:00:39,160 Right. 12 00:00:39,170 --> 00:00:39,710 Let's see. 13 00:00:39,710 --> 00:00:40,190 Let's see. 14 00:00:40,190 --> 00:00:40,970 Let's see. 15 00:00:41,330 --> 00:00:42,100 Palindrome. 16 00:00:42,110 --> 00:00:42,510 Awesome. 17 00:00:42,950 --> 00:00:53,870 So basically palindrome is just it can be a word, the a phrase OK, which is a sequence of some digits 18 00:00:53,870 --> 00:00:54,830 or characters. 19 00:00:55,820 --> 00:01:02,930 And if you read it from the left to the right, OK, it should be the same as you read it from the right 20 00:01:03,080 --> 00:01:03,810 to the left. 21 00:01:04,250 --> 00:01:10,520 So in our case, in our case, if we will take a look, it's like, I don't know, erase it since we 22 00:01:10,520 --> 00:01:11,480 worked with a race. 23 00:01:11,690 --> 00:01:15,050 So let's say one, three, two, three, one. 24 00:01:15,590 --> 00:01:21,680 And if we read this array from left to right, we will see that there was one, three, two, three, 25 00:01:21,680 --> 00:01:22,010 one. 26 00:01:22,370 --> 00:01:28,130 And if we read this array from the right to the left, we will see like one, three, two, three, 27 00:01:28,130 --> 00:01:29,910 one, which is the same. 28 00:01:30,020 --> 00:01:35,660 OK, so we will see in this case that this array is palindrome. 29 00:01:35,880 --> 00:01:40,940 OK, so if you read from left to the right and if you read from their right to the left and you get 30 00:01:40,940 --> 00:01:46,670 like the same things, then this array basically is palindrome. 31 00:01:47,660 --> 00:01:51,830 So, yeah, so are the array. 32 00:01:51,830 --> 00:01:56,600 Size may also be of an even size and it may also be of an odd size. 33 00:01:56,640 --> 00:02:00,500 OK, so actually I don't think it really matters. 34 00:02:00,500 --> 00:02:05,450 So let's say one, one, two, three, three to one. 35 00:02:05,480 --> 00:02:13,280 So this array will be also a palindrome and basically it will take like a three like this one four six 36 00:02:13,280 --> 00:02:13,610 two. 37 00:02:13,880 --> 00:02:18,320 Then this array is absolutely not a palindrome palindrome. 38 00:02:18,680 --> 00:02:21,310 But these two are palindromes. 39 00:02:21,320 --> 00:02:23,690 The first one is of an odd size or a. 40 00:02:24,580 --> 00:02:28,870 And the second one is of a and even sizably. 41 00:02:29,380 --> 00:02:30,700 OK, good. 42 00:02:31,000 --> 00:02:35,490 So what we have to do is to write a simple program, OK? 43 00:02:35,800 --> 00:02:42,670 We program the prints and the checks out and prints if given a raise, a palindrome. 44 00:02:42,670 --> 00:02:53,290 So or write down write a program that checks and prints if a given array. 45 00:02:55,190 --> 00:02:59,840 He's a palindrome or not. 46 00:03:01,040 --> 00:03:05,300 OK, so that's how are what we need to do. 47 00:03:06,130 --> 00:03:10,280 And with that being said, let us start working. 48 00:03:10,840 --> 00:03:14,740 So, first of all, let's create an array of some size. 49 00:03:14,770 --> 00:03:15,900 Doesn't really matter. 50 00:03:17,130 --> 00:03:26,940 And we know that basically, guys, what do you think what do you think is the best idea to solve this 51 00:03:26,940 --> 00:03:29,140 kind of problem, this kind of exercise? 52 00:03:29,550 --> 00:03:31,200 So there are a couple of options. 53 00:03:31,540 --> 00:03:32,910 OK, a couple of options. 54 00:03:33,720 --> 00:03:43,290 The first option is like to find some reason before you actually start solving it in one of the questions, 55 00:03:43,620 --> 00:03:45,420 what what should be the condition? 56 00:03:45,450 --> 00:03:54,270 So basically, we understand that probably all the elements of this, we will need to be checked, like 57 00:03:54,330 --> 00:04:00,540 they will need to be at least to check that if we read it from left to right or from right to left, 58 00:04:01,020 --> 00:04:02,850 then we need to check it. 59 00:04:03,930 --> 00:04:08,340 So what I suggest us to do is to see the following pattern. 60 00:04:08,760 --> 00:04:11,520 If you will, take a look at the leftmost element. 61 00:04:11,910 --> 00:04:18,870 And here in the rightmost, they should be identical, since if you read from left to right, that will 62 00:04:18,870 --> 00:04:20,070 be the first element. 63 00:04:20,320 --> 00:04:24,040 And if you read from right to left, that should be also the first element. 64 00:04:24,570 --> 00:04:31,410 And if we assume that these arrays should be a palindrome, then both of these values should be the 65 00:04:31,410 --> 00:04:31,820 same. 66 00:04:32,760 --> 00:04:39,750 And then if we take this value, the second value on the left and the second value on the right, we 67 00:04:39,750 --> 00:04:48,840 should they also should be the same, since they are the second value in the reading sequence for both 68 00:04:48,840 --> 00:04:49,230 of them. 69 00:04:49,500 --> 00:04:52,060 So that's why they also should be the same. 70 00:04:52,710 --> 00:04:59,460 And if we take a look at this even size array, then we know that, OK, we reached the middle ground, 71 00:04:59,490 --> 00:05:00,360 no problem. 72 00:05:00,670 --> 00:05:07,650 And if we have like an outsize array, then we know that if we reach some point when we have like one 73 00:05:07,650 --> 00:05:15,510 value in the middle, so that definitely that's a palindrome since it five equals to five, if you read 74 00:05:15,510 --> 00:05:21,150 it from left or if you read it from right, doesn't really matter. 75 00:05:21,990 --> 00:05:31,230 OK, so, um, yeah, so that's basically would be our main logic behind this exercise, let's start 76 00:05:31,230 --> 00:05:31,950 solving it. 77 00:05:32,520 --> 00:05:37,530 So let's create I don't know, I let's start iterating over all the elements. 78 00:05:37,560 --> 00:05:44,370 So for I equals to zero as long as I is less than less than what? 79 00:05:45,000 --> 00:05:46,930 What do you think should be the condition here? 80 00:05:47,280 --> 00:05:48,080 What do you think? 81 00:05:48,480 --> 00:05:51,660 Should we simply leave it like i's less than size. 82 00:05:51,660 --> 00:05:52,160 I plus. 83 00:05:52,170 --> 00:05:52,530 Plus. 84 00:05:53,700 --> 00:06:00,600 Well, I mean, maybe OK, but it also may for some scenarios that do not work. 85 00:06:01,590 --> 00:06:07,000 So what I suggest this to do is to just make it beautiful. 86 00:06:07,230 --> 00:06:16,890 OK, what I suggest this to do is to understand that we will need to simply compare and run these for 87 00:06:16,890 --> 00:06:23,130 a loop until we reach the middle of the array, because there is no reason to continue checking out 88 00:06:23,130 --> 00:06:25,320 after we've passed the middle. 89 00:06:26,380 --> 00:06:28,310 Because the values are basically the same. 90 00:06:28,900 --> 00:06:35,590 So as long as I is less than size divided by two, then in this case we will ask the following condition. 91 00:06:35,710 --> 00:06:36,970 What will be the condition? 92 00:06:38,320 --> 00:06:45,550 So the condition should be something like this, if you are in decline, meaning reading the value from 93 00:06:45,550 --> 00:06:53,080 the left does not equal to ARRL in the exercise minus one minus. 94 00:06:53,080 --> 00:06:57,040 I write because we read it from the right. 95 00:06:57,550 --> 00:07:05,250 And if basically they are not the same, then it's basically I suggest you do take a look at this on 96 00:07:05,800 --> 00:07:15,820 this operation, like we are looking for at least a pair of elements that will not satisfy the condition 97 00:07:15,820 --> 00:07:17,140 of the quality. 98 00:07:17,140 --> 00:07:24,200 And then we will be able to assume and to basically say that this array is not a palindrome. 99 00:07:24,640 --> 00:07:31,330 So if that's the case, then maybe we should also, like I don't know, maybe we should also keep a 100 00:07:31,330 --> 00:07:33,430 flag like a flag equal to one. 101 00:07:33,730 --> 00:07:36,130 And we will assume that this flag says that. 102 00:07:36,310 --> 00:07:44,130 We assume we assume that the array that the array a palindrome. 103 00:07:44,860 --> 00:07:45,970 That's our assumption. 104 00:07:46,780 --> 00:07:54,520 And if the array index does not equal to an array its size minus one minus sign, meaning the the element. 105 00:07:56,650 --> 00:07:57,840 From the left side. 106 00:08:00,500 --> 00:08:01,460 Does not equal. 107 00:08:04,010 --> 00:08:05,090 To the element. 108 00:08:07,580 --> 00:08:16,100 On the right side, then, definitely it means that the array, OK, is not he's not of. 109 00:08:18,550 --> 00:08:26,380 He's not a palindrome, and then we can see, like flag equals zero and basically let's break from this 110 00:08:26,380 --> 00:08:36,100 for a loop and then we come back to this place and we ask the following if flag equals to zero or basically 111 00:08:36,100 --> 00:08:38,260 if it's the one so pretty def. 112 00:08:39,500 --> 00:08:45,770 Printout of the array is a palindrome. 113 00:08:48,460 --> 00:08:57,400 Otherwise, they'll see flat sales flying close to zero in this case, what we have to print is simply 114 00:08:57,400 --> 00:08:58,160 print out. 115 00:08:59,770 --> 00:09:04,960 The array is not a palindrome. 116 00:09:06,820 --> 00:09:11,590 OK, so that's basically it for how you should solve it. 117 00:09:11,630 --> 00:09:17,110 Now, let's simply take a look at executing one or two examples. 118 00:09:17,860 --> 00:09:22,480 So previously we said like, let's take a look at this one first example. 119 00:09:23,080 --> 00:09:30,360 Let's use size equals to at least one, initialize it and now build and run it. 120 00:09:31,000 --> 00:09:34,020 And this array is palindrome. 121 00:09:34,510 --> 00:09:39,940 And let's try the second example to make sure that it's also a palindrome. 122 00:09:40,990 --> 00:09:44,210 Builder Ron, what happened? 123 00:09:44,260 --> 00:09:46,780 I'm sorry, sorry, what's going on? 124 00:09:46,930 --> 00:09:47,680 One second. 125 00:09:49,360 --> 00:09:54,020 And we can basically see that we have here the phrase not a palindrome. 126 00:09:54,400 --> 00:09:56,590 So why is that? 127 00:09:56,920 --> 00:09:58,600 Oh, here it is. 128 00:09:58,870 --> 00:10:05,740 The problem is, since we define size to be of size five, any tier of size six, so let's simply redefine 129 00:10:05,750 --> 00:10:07,840 the size to six and rebuild it. 130 00:10:08,710 --> 00:10:14,000 And let's see, the array is a palindrome, so now we can keep on moving. 131 00:10:14,290 --> 00:10:21,770 And finally, let's take the last break here and go like this and also change the size before and build 132 00:10:21,770 --> 00:10:22,560 their run. 133 00:10:23,530 --> 00:10:26,440 And finally, the solution is come. 134 00:10:26,440 --> 00:10:30,770 And the array is not a palindrome. 135 00:10:30,840 --> 00:10:31,900 Yeah, I think I lost it. 136 00:10:33,270 --> 00:10:33,550 Yeah. 137 00:10:33,560 --> 00:10:36,010 So this is it for this video, guys. 138 00:10:36,010 --> 00:10:37,210 I hope you like it. 139 00:10:38,800 --> 00:10:45,760 Try to execute it also on your own today, tomorrow just to practice and to make sure you understand 140 00:10:46,300 --> 00:10:50,300 each and every one of the concepts and things that were discussed here. 141 00:10:50,320 --> 00:10:54,240 Of course, there are additional options to solve this exercise. 142 00:10:54,260 --> 00:11:02,290 Try them also compare your results, see if it works, make sure that you understand everything that 143 00:11:02,290 --> 00:11:07,000 you use, erase conditions and so on and so forth. 144 00:11:07,750 --> 00:11:08,890 Thank you so much for watching. 145 00:11:08,920 --> 00:11:09,810 My name is Lot. 146 00:11:09,820 --> 00:11:10,900 This is Alphatech. 147 00:11:10,900 --> 00:11:11,800 Leave some review. 148 00:11:11,810 --> 00:11:15,430 Let me know what you think of the course so far and until next time. 149 00:11:15,430 --> 00:11:16,270 I'll see you then. 13502

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.