All language subtitles for 14. Continue (Upgrade) Rotate Left a given array by N positions - Solution

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,820 --> 00:00:02,010 All right. 2 00:00:02,290 --> 00:00:05,650 So have you come to some solution? 3 00:00:06,860 --> 00:00:11,630 If so, please also feel free to share it with us, so we could take a look at it together. 4 00:00:12,530 --> 00:00:17,480 But for now, let us solve it using this approach that I'm about to show you. 5 00:00:18,500 --> 00:00:24,320 So first of all, what I want you to understand is, yeah, of course, we can separate all of them 6 00:00:24,320 --> 00:00:27,050 into two functions into two separate functions. 7 00:00:27,470 --> 00:00:35,450 But for now, since we are just practicing the programming and the general approach for algorithms, 8 00:00:35,450 --> 00:00:42,950 some basic algorithms to rotate it to left by in positions, we are going to ask the following question 9 00:00:42,950 --> 00:00:49,040 OK, I'm going to make it very, very straightforward, so we will not spend a lot of time on it. 10 00:00:49,580 --> 00:00:51,230 So I want to ask you this one. 11 00:00:52,690 --> 00:00:57,750 So we know that these part of code, we know that these aren't. 12 00:00:58,270 --> 00:01:01,530 He's in charge of rotating by one, right? 13 00:01:01,870 --> 00:01:04,540 Rotate by one position. 14 00:01:04,660 --> 00:01:05,440 One was. 15 00:01:07,320 --> 00:01:15,240 So what will happen if we apply rotate by one position to this array, so we know that after applying 16 00:01:15,240 --> 00:01:20,850 these code, what we will get is the following three, four, seven, three and five. 17 00:01:21,600 --> 00:01:22,560 Is this correct? 18 00:01:23,310 --> 00:01:27,300 So this was to rotate by one. 19 00:01:28,260 --> 00:01:31,230 And that's something that we have created in previous videos. 20 00:01:32,770 --> 00:01:34,870 But that's not the expected result. 21 00:01:35,350 --> 00:01:44,230 This is the expected to result, so from this to this, what we need to do is basically to take this 22 00:01:44,230 --> 00:01:45,550 array once again. 23 00:01:46,930 --> 00:01:49,780 And to apply on it, what should we apply in it? 24 00:01:50,020 --> 00:01:53,860 Once again, the operation of rotate by one. 25 00:01:55,010 --> 00:02:03,110 That's all that's all we need to do if we rotate this array by one again, so for will, go to there 26 00:02:03,110 --> 00:02:07,790 in seven three five will be at the beginning and that should be the final result. 27 00:02:08,360 --> 00:02:15,810 So we should use the main functionality here of rotating by one, rotate by one, rotate by one. 28 00:02:16,070 --> 00:02:20,510 How many times and times is it clear? 29 00:02:21,440 --> 00:02:27,740 So that's the main objective of what we want to do here and what do we want to achieve in solving this 30 00:02:27,740 --> 00:02:28,520 exercise? 31 00:02:29,240 --> 00:02:32,060 So let me show you how it will look in code. 32 00:02:32,840 --> 00:02:37,550 So we said previously that these part of rotating by one position looks like this. 33 00:02:39,040 --> 00:02:44,530 And now what we need to do is, let's say we defined an or you created a variable in and read it from 34 00:02:44,530 --> 00:02:47,590 the user once again doesn't really matter. 35 00:02:47,860 --> 00:02:50,640 But what is matter to us? 36 00:02:50,650 --> 00:02:57,640 What does matter to us is every basically every time to apply these part of code. 37 00:02:58,540 --> 00:02:58,990 OK? 38 00:02:59,020 --> 00:03:05,140 That can again be used as an external function, but for now, for simplicity. 39 00:03:05,290 --> 00:03:11,860 Let's leave it this way because we build our way up so we can use another for a loop. 40 00:03:12,220 --> 00:03:12,730 OK? 41 00:03:13,060 --> 00:03:16,270 Using some, I don't know, additional variable G. 42 00:03:17,690 --> 00:03:21,770 OK, or better, I say let's use Kate will be better for understanding. 43 00:03:22,580 --> 00:03:33,110 So for gay equals to zero as case less than what how many times we want to do all of this part of code, 44 00:03:33,440 --> 00:03:34,300 we want to do it. 45 00:03:34,310 --> 00:03:40,760 And times so gay equals to zero as long as gay is less than M K plus plus. 46 00:03:41,600 --> 00:03:52,790 So these are part of code eight makes sure that we will use their reported left one element, one position 47 00:03:53,030 --> 00:03:53,870 and times. 48 00:03:54,650 --> 00:03:57,290 And basically, that's what will happen. 49 00:03:58,280 --> 00:04:03,470 So we take the array once here we rotate it to the left. 50 00:04:03,470 --> 00:04:04,370 That's what we get. 51 00:04:04,970 --> 00:04:07,760 Then we go back to the outer loop. 52 00:04:08,360 --> 00:04:09,800 We communicate by one. 53 00:04:09,800 --> 00:04:11,570 We ask one is less than two. 54 00:04:11,600 --> 00:04:15,980 Yes, so we make the rotation once again on this array. 55 00:04:16,930 --> 00:04:24,370 And then we get this array and then we go, Kate plus one and we get to is to less than two. 56 00:04:24,400 --> 00:04:25,270 The answer is no. 57 00:04:25,480 --> 00:04:26,440 And we are done. 58 00:04:26,770 --> 00:04:32,590 And now you should be able to print the array again and to see the expected results. 59 00:04:34,140 --> 00:04:34,580 OK. 60 00:04:35,640 --> 00:04:41,130 So, yeah, I hope this is clear, guys, and if you have any questions, feel free to ask. 61 00:04:41,460 --> 00:04:43,290 Please run some tests on your own. 62 00:04:43,290 --> 00:04:49,710 Make sure that everything works as expected because we do not have the exact full solutions. 63 00:04:49,920 --> 00:04:54,510 We solve it together with you, at least in some of the exercises. 64 00:04:55,050 --> 00:04:58,260 So, yeah, thank you so much for watching. 65 00:04:58,650 --> 00:05:00,550 Leave me some reviews, some feedback. 66 00:05:00,570 --> 00:05:09,750 It always helps and assists for me to know your thoughts and improving the content if it needs to be 67 00:05:09,750 --> 00:05:10,200 improved. 68 00:05:11,250 --> 00:05:16,710 But for now, thank you so much for watching again, and I'll see you in the next video. 69 00:05:16,800 --> 00:05:18,750 My name is Ludd Lisas alpha tech. 70 00:05:18,930 --> 00:05:19,350 My. 6492

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