All language subtitles for 16. Continue (Upgrade2) Rotate RIGHT a given array by N positions - Solution

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
tr Turkish
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

Original subtitles

OK, so let's take a look at what should be done in the solution.

Basically, once we implement just the part of rotating by one to the right, then I think it shouldn't

be much of a problem to make the rotations right by end positions, which should be pretty much the

same.

So we will leave the outer loop as is.

We will use temp equal to want.

What do we know?

What do we want to take into account?

So first of all, let's start and understand basically the main steps for implementing rotate by one.

So we want all of them to move by one element to the right.

OK.

That's what we want to do using some for a loop.

Probably, right?

But we don't need and we don't want these value the right most value to be.

To be basically deleted with the value of seven when we rotate to the right because we did not use it

right here yet.

So what we will create, we will create a temp variable.

And now these temp variable will be for inserting these for a loop.

We will put it a value of three or basically the final element in the value series or values a at index

size minus one.

OK, that's what we'll go to temp and then we will use a for a loop, for a loop that should start from

where if we will start the for a loop from equal to one, as long as is less than size and do something

very similar, then it may be kind of a problem because if we put five here, then on the next iteration

we lost the four.

So we should start maybe from another way, another option because we do not want to lose track of any

value.

We may start with the value of size minus one, right?

Start from this value right here and we will do that as long as I is greater than zero or one will see

right away.

And basically, we will say that every time that, first of all, we will put here the value of the

element on its left.

So we will place here at 7:00, then we will move to this one, we will place here for the valley on

its left.

We will place here five when equal to one.

And when I pull to zero, we will not do anything, so we'll basically stop.

So as long as I is greater than zero, then we are going to do this operation.

And finally, after words, we will put the value in sitemap to the left most element.

And we will get here at 3:00.

So is there anything clear if you have any questions, feel free to ask them in the U.S. and we will

gladly answer them.

So let's try to figure out now what we should change and what we should modify.

So this part of the explanation is one of the most important parts that you need to be familiar with

in order to basically to know how to approach this exercise.

So what we will do is we will say temp will be equal.

OK?

This part refers to rotating by one to the right.

OK, given away so it will be equal to value, zero are at index size minus one the right most element.

And then we will start from i.e. equal to what equal to size minus one.

That's the index of the right most element.

As long as I is greater than what then zero, but not included I minus minus.

OK.

That's what we are going to do.

And on every iteration, what we want to do is to take the value of the previous, the value on of the

element on the left and to put it inside here.

Okay, so what what did we have previously?

Let me get it back.

What did we have previously?

We had like five four, seven three.

So we want seven here.

So what we will do is, come on, what happened?

Yeah.

Okay, so we will see the value in this specific index right now should be equal to the value on what?

On my left.

OK.

And that kind of ensures also I'm minus one, you know, that the the largest index is equal to one.

So you will not basically.

Go out of bounds.

So once you are done with it, all you will have is this array.

Like that?

OK, so you will have

five.

Four seven.

And also here will be five in the final step, which is this one will be used for what the reporting

values the error at index zero.

OK.

With the value inside of variable temp.

So the final result should be like this.

Three five four seven.

That's the rotation by one to their right.

That's all that happened.

And now once once we close it using this outer loop.

We do this operation over and over how many times and times that's what we do.

Is it clear that's it?

Thank you for watching and enjoy.

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