All language subtitles for 16. Advanced - Even Digits Sum

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,600 --> 00:00:08,850 All right, so what are we going to do in this exercise, so in this exercise, what we are going to 2 00:00:08,850 --> 00:00:16,680 do is pretty interesting, OK, not so trivial and not so easy because, you know, like, we are getting 3 00:00:16,680 --> 00:00:23,460 better and better every exercise and we should also make the exercise a little bit harder. 4 00:00:24,500 --> 00:00:34,370 So what we are going to do is let me see wrote it down here, so what we are going to do is to make. 5 00:00:36,600 --> 00:00:50,040 We are going to write right down a recursive function that gets in an integer. 6 00:00:50,220 --> 00:01:04,860 OK, and these function is going to return one if all the basically the sum of all the numbers in the 7 00:01:04,860 --> 00:01:08,340 received value is. 8 00:01:09,140 --> 00:01:15,140 Even OK, otherwise, we should return. 9 00:01:16,300 --> 00:01:18,710 Return one. 10 00:01:19,660 --> 00:01:29,860 OK, so a recursive function that gets an integer, let's say, I don't know, some end and an OK in 11 00:01:29,860 --> 00:01:36,130 these function is going to return one if the sum of all the number of digits. 12 00:01:36,160 --> 00:01:44,590 OK, I didn't specify if all the sum of all the digits in the received number is even. 13 00:01:44,770 --> 00:01:48,190 OK, so basically you take all the digits in a given. 14 00:01:48,190 --> 00:01:56,440 No, you sum them up and you return one if the result is even otherwise, if the result is odd, you 15 00:01:56,440 --> 00:01:58,000 return zero. 16 00:01:58,120 --> 00:02:00,460 OK, so a little bit mistake here. 17 00:02:01,270 --> 00:02:03,660 OK, so that's what you do. 18 00:02:03,970 --> 00:02:07,900 And basically let's take a look at the example, number one. 19 00:02:07,900 --> 00:02:16,900 And if the value is, let's say, an equal to one five six, then in this case, if you sum them up, 20 00:02:16,900 --> 00:02:21,550 that's going to be one plus five, one plus five plus six. 21 00:02:22,030 --> 00:02:24,480 A total result will be 12. 22 00:02:24,700 --> 00:02:31,870 And that's an even number and even some because it can be divided by two without the remainder. 23 00:02:32,590 --> 00:02:40,810 Then that's why the final result, final return value will be in this case one. 24 00:02:41,770 --> 00:02:43,670 And if the sum. 25 00:02:43,690 --> 00:02:45,660 OK, let's take another example. 26 00:02:46,090 --> 00:02:50,390 And if the sum of, I don't know, example to let's say three five. 27 00:02:50,650 --> 00:02:52,420 OK, something like this. 28 00:02:54,270 --> 00:03:02,010 Thirty six thousand eight thousand eight hundred fifty nine in this case, the same is going to be like 29 00:03:03,000 --> 00:03:10,890 three plus six plus eight plus five plus nine, which will leave us a total of what it will give us 30 00:03:10,890 --> 00:03:11,900 11 plus nine. 31 00:03:11,910 --> 00:03:15,620 Twenty thirty three, if I'm not mistaken. 32 00:03:15,630 --> 00:03:15,950 Right. 33 00:03:16,350 --> 00:03:24,240 So this is nine nine plus nine eighteen plus thirteen. 34 00:03:24,450 --> 00:03:27,030 The thirty one thirty one Miami stake. 35 00:03:28,010 --> 00:03:34,580 OK, so thirty one and the final result is going to be zero because the sum is odd. 36 00:03:34,940 --> 00:03:37,850 OK, so that's what do you have to do in this exercise? 37 00:03:38,250 --> 00:03:43,280 That's what do you have to practice and to try running this on your own. 38 00:03:43,790 --> 00:03:45,570 So recursive function. 39 00:03:45,710 --> 00:03:48,830 Take your time and I'll see you in the Solutions video. 40 00:03:49,680 --> 00:03:55,440 And of course, by saying the solutions video, I will simply simply think I will make it in this one, 41 00:03:55,980 --> 00:04:03,060 because you can always pause the video and you can always come back and try writing this code on your 42 00:04:03,090 --> 00:04:03,400 own. 43 00:04:03,420 --> 00:04:03,720 So. 44 00:04:05,120 --> 00:04:09,550 Let us start thinking of what should be the solution, guys. 45 00:04:09,700 --> 00:04:11,320 OK, so what do you think? 46 00:04:11,330 --> 00:04:14,670 How should we even start this exercise? 47 00:04:14,720 --> 00:04:15,380 What do you think? 48 00:04:17,130 --> 00:04:20,910 What will be the signature of this function? 49 00:04:21,360 --> 00:04:22,530 What should be its signature? 50 00:04:22,560 --> 00:04:30,630 So basically, if it's going to return either zero or one, we can always make a boolean result. 51 00:04:30,630 --> 00:04:36,650 But let's stick with integers just for simplicity, because this section is not about it. 52 00:04:36,660 --> 00:04:40,280 It's about the recursive manner and the recursive calls. 53 00:04:40,740 --> 00:04:48,450 So end let's make it, um, I don't know, digits some even. 54 00:04:48,940 --> 00:04:53,670 OK, and we are going to get value and awesome. 55 00:04:53,700 --> 00:05:02,360 So now what we have to do is to start thinking of how we can basically even approach this exercise. 56 00:05:02,370 --> 00:05:10,590 How can we solve it, because that's not so easy and not so trivial is a few examples that we've done 57 00:05:10,590 --> 00:05:12,120 at the beginning of this section. 58 00:05:13,080 --> 00:05:15,210 So, guys, what are your thoughts? 59 00:05:15,600 --> 00:05:23,610 Try to think about it, try to come up with at least one or two options and basically try to run some 60 00:05:23,610 --> 00:05:25,590 code to see how it works. 61 00:05:25,590 --> 00:05:26,670 Will it work? 62 00:05:27,030 --> 00:05:28,890 OK, so think about it. 63 00:05:29,220 --> 00:05:30,060 Think about it. 64 00:05:30,060 --> 00:05:31,140 Take some time. 65 00:05:31,620 --> 00:05:36,860 And once you're done, let's continue to gather. 66 00:05:38,190 --> 00:05:45,320 OK, so what I suggest to do, first of all, is to think of some logic on how it can be solved. 67 00:05:45,960 --> 00:05:48,820 So let's just draw something here. 68 00:05:48,960 --> 00:05:52,770 Let's start with the simple example of one five six. 69 00:05:53,800 --> 00:06:03,850 OK, so one five six one five six, so what do we want to do is somehow on every on every recursive 70 00:06:03,850 --> 00:06:07,100 call to check out some status? 71 00:06:07,120 --> 00:06:16,210 OK, so you have to to think of of some rule that can be applied on every recursive call and basically 72 00:06:16,210 --> 00:06:23,050 based on these rule, finally, once we will get kind of back from our recursive calls, we will be 73 00:06:23,050 --> 00:06:29,430 able to make some conclusions for their result so far. 74 00:06:29,440 --> 00:06:31,780 So if we take one, five, six. 75 00:06:32,770 --> 00:06:42,340 And we just I don't know, and we just let's think about it together and we just will divide it like 76 00:06:42,340 --> 00:06:48,940 two, one, five and six, and then we will divide these one five into one and five. 77 00:06:49,750 --> 00:06:56,880 You know, we'll say the following thing, we'll say that basically we always know we always know that 78 00:06:56,880 --> 00:07:06,930 the base result will be like probably just one digit because we know that one digit he can be the results 79 00:07:06,930 --> 00:07:11,280 for it can be decided, you know, like trivially right away. 80 00:07:11,310 --> 00:07:15,030 So let's start with this with this condition. 81 00:07:15,040 --> 00:07:25,230 So if and is less than is less than 10, OK, meaning if it's a one digit number, then in this case, 82 00:07:25,230 --> 00:07:26,460 that's very simple. 83 00:07:26,610 --> 00:07:34,530 We can say that give and can be divided by two without a remainder, then it means this number is an 84 00:07:34,530 --> 00:07:36,950 even number that in this case we can return. 85 00:07:37,260 --> 00:07:37,920 What can we do? 86 00:07:37,920 --> 00:07:39,060 Return one. 87 00:07:39,330 --> 00:07:43,980 OK, so if M can be divided by two without the remainder. 88 00:07:45,040 --> 00:07:50,090 Then we can return one and we can also say the following. 89 00:07:50,590 --> 00:07:55,280 Let's take like this case, it will be much clearer to you guys. 90 00:07:55,280 --> 00:08:01,630 So elusive and divided by two does not equal to zero in this case. 91 00:08:01,640 --> 00:08:03,280 It's an odd number. 92 00:08:03,850 --> 00:08:06,690 In this way we are going to return zero. 93 00:08:06,970 --> 00:08:14,800 OK, so if M is less than zero, then we are going to ask if it can be divided by two without a remainder 94 00:08:14,800 --> 00:08:16,720 returned one otherwise returns zero. 95 00:08:16,750 --> 00:08:21,370 So that's basically the base case that we can work with. 96 00:08:22,220 --> 00:08:23,770 Now comes the question of. 97 00:08:26,010 --> 00:08:29,820 Of what we should we do if it's not the base case? 98 00:08:30,050 --> 00:08:33,810 OK, so that's the base case, let's say one in five. 99 00:08:35,200 --> 00:08:41,830 And we know that one in five, for example, for five, we can find the result pretty, pretty easily 100 00:08:41,830 --> 00:08:42,160 right. 101 00:08:42,160 --> 00:08:43,010 For or for one. 102 00:08:43,120 --> 00:08:44,130 We know that one. 103 00:08:44,620 --> 00:08:47,020 Let's make it like this color. 104 00:08:47,770 --> 00:08:52,510 And we can say that one is, of course, and definitely one is. 105 00:08:52,540 --> 00:08:56,140 What is an odd number is an odd number. 106 00:08:56,470 --> 00:09:00,490 And we are we know that this function is going to return for an odd number. 107 00:09:00,700 --> 00:09:02,260 It's going to return zero. 108 00:09:02,350 --> 00:09:07,810 OK, so these function is going to return zero for these base case of one. 109 00:09:08,800 --> 00:09:16,840 OK, and what I want you to think about is that, first of all, we are probably always going to return 110 00:09:16,840 --> 00:09:19,220 either one or zero. 111 00:09:19,270 --> 00:09:25,390 We are not going to return anything else because the final result should be either zero or one. 112 00:09:25,720 --> 00:09:27,550 And we don't want to like to. 113 00:09:28,640 --> 00:09:29,990 Mess things up. 114 00:09:30,230 --> 00:09:35,660 OK, so maybe there is also an option to like to return the some. 115 00:09:36,750 --> 00:09:43,140 I'm not sure about it, we maybe try to think about it or come up with a solution and let me know in 116 00:09:43,140 --> 00:09:51,600 the comments and in the questions, if you manage to find another solution to mine by returning this 117 00:09:51,600 --> 00:09:56,460 sum and finally to making some assumptions and conclusions. 118 00:09:56,820 --> 00:10:03,540 But for this solution, I'm going to always kind of try to return either a zero or one based on the 119 00:10:03,540 --> 00:10:05,400 result so far. 120 00:10:05,520 --> 00:10:15,720 Okay, so now I'm going to say that that's the base case and let's try to try to think about it like. 121 00:10:16,620 --> 00:10:18,420 The results so far. 122 00:10:18,600 --> 00:10:28,920 OK, so let's use something like this, let's create additional variable results so far. 123 00:10:29,190 --> 00:10:38,540 OK, and this variable will have like resolved result result so far is going to be equal to digits, 124 00:10:38,550 --> 00:10:40,500 some even for. 125 00:10:40,530 --> 00:10:42,880 I'm just trying to build this together with you. 126 00:10:42,960 --> 00:10:51,500 OK, so the result is going to be digits, some even for and divided by two, which means without the 127 00:10:51,510 --> 00:10:52,670 rightmost digit. 128 00:10:53,880 --> 00:10:58,110 So we know that digits some even can return one. 129 00:10:58,500 --> 00:11:05,850 If if the sum of all the digits is even otherwise, it will return to zero. 130 00:11:05,860 --> 00:11:10,290 So we will call the results so far, meaning four one five in this case. 131 00:11:11,910 --> 00:11:14,920 The results so far, OK, no problem. 132 00:11:14,940 --> 00:11:16,860 So that's basically how it will look like. 133 00:11:16,860 --> 00:11:18,340 Let me just draw it here. 134 00:11:18,450 --> 00:11:25,020 OK, so let's say it's going to be something like this, just trying to draw the structure together 135 00:11:25,020 --> 00:11:27,630 with you so and equals to one, five, six. 136 00:11:27,840 --> 00:11:33,540 And then we are going also to call for an equals to one five and also four and equals to six. 137 00:11:34,050 --> 00:11:35,460 OK, and that's it. 138 00:11:35,760 --> 00:11:38,940 And on every iteration we are going also to hold a variable. 139 00:11:38,950 --> 00:11:45,230 This result, let's call it r r equals to this result return from here. 140 00:11:45,780 --> 00:11:50,460 And this is going to have also the result return from here. 141 00:11:51,060 --> 00:11:57,090 And basically we know that this equals to six will we will satisfy the base condition. 142 00:11:57,100 --> 00:11:58,290 It's less than 10. 143 00:11:58,530 --> 00:12:04,990 And he's going in this case to return one thing since since this value is even. 144 00:12:05,010 --> 00:12:07,020 OK, so our equals to one. 145 00:12:07,410 --> 00:12:09,340 And these are equal to one. 146 00:12:09,360 --> 00:12:11,700 What it indicates is that. 147 00:12:12,850 --> 00:12:15,520 The results so far result. 148 00:12:16,540 --> 00:12:17,560 So far. 149 00:12:18,860 --> 00:12:24,320 Is what is even the result so far, is even. 150 00:12:25,540 --> 00:12:32,060 OK, OK, so the result so far is even and what can we make out of this conclusion? 151 00:12:32,080 --> 00:12:41,230 We know that the result so far is even so, we maybe try to kind of formulate a question to see if we 152 00:12:41,230 --> 00:12:43,780 can like it further. 153 00:12:44,900 --> 00:12:54,230 It was so oops, my mistake, guys, sorry for that, it's divided every time by 10, so it should be 154 00:12:54,230 --> 00:12:55,780 like one five in here. 155 00:12:55,790 --> 00:12:56,870 It should be one. 156 00:12:56,870 --> 00:12:57,590 I'm sorry. 157 00:12:57,590 --> 00:12:59,120 Sorry, sorry for that. 158 00:12:59,900 --> 00:13:03,100 It should be one so and equals to one. 159 00:13:04,070 --> 00:13:09,140 And here are should be equal to zero since no one is an odd number. 160 00:13:09,140 --> 00:13:11,650 So that's also I'm going to change here. 161 00:13:11,660 --> 00:13:14,990 So that's going to be an odd value. 162 00:13:15,020 --> 00:13:17,270 OK, so results so far is odd. 163 00:13:17,870 --> 00:13:20,330 OK, so let's try to now proceed. 164 00:13:20,540 --> 00:13:27,010 And what we are going to do is that we know that we have an equal to one five and we know that the results 165 00:13:27,020 --> 00:13:31,930 are far from the from the left is an odd result. 166 00:13:32,540 --> 00:13:35,690 So we are going to ask also a question if. 167 00:13:36,950 --> 00:13:39,140 What should we ask, what do you think those? 168 00:13:41,770 --> 00:13:43,690 What do you think we should ask now? 169 00:13:44,590 --> 00:13:53,080 We can definitely ask about these rightmost digits right now and we can ask if it equals two, basically 170 00:13:53,080 --> 00:13:55,020 if it's an even or odd. 171 00:13:55,030 --> 00:13:56,110 So if. 172 00:13:56,740 --> 00:13:57,160 If. 173 00:13:59,380 --> 00:14:06,230 How can you find this Redwater statement basically use and do let him write, it will give you the rightmost 174 00:14:06,250 --> 00:14:14,710 digit in this number and help you find if this result is even or odd, you're basically going to. 175 00:14:15,780 --> 00:14:23,100 Divided by two, OK, Modula two so if that's the case, if if. 176 00:14:24,770 --> 00:14:31,130 If it's even then what you are going to do, we're going to ask again. 177 00:14:31,340 --> 00:14:32,850 Let's ask another question. 178 00:14:32,870 --> 00:14:44,090 So now if if the results so far results so far, if it was if it was one, it means if the result so 179 00:14:44,090 --> 00:14:52,340 far is odd, OK, if the result so far is odd, OK, the results so far is odd. 180 00:14:53,120 --> 00:15:05,900 And these rightmost digit is even then in this case, you know, that is some of odd plus and even will 181 00:15:05,900 --> 00:15:08,840 always give you a result of OD. 182 00:15:09,110 --> 00:15:11,320 So that's why you are going to return one. 183 00:15:12,110 --> 00:15:21,320 And if that's not the case, OK else meaning the result so far equals to zero. 184 00:15:21,890 --> 00:15:34,560 OK, then it means what it means that the result so far is even OK then in this case you know that we 185 00:15:34,560 --> 00:15:38,390 are talking about a situation where these digits is even. 186 00:15:38,390 --> 00:15:45,050 So you know that the result so far is even plus these given digit is even so the final result, the 187 00:15:45,050 --> 00:15:47,560 sum of them is also going to be even worse. 188 00:15:47,600 --> 00:15:50,550 And that's why we are going to return zero. 189 00:15:51,140 --> 00:15:53,270 OK, not so trivial. 190 00:15:53,270 --> 00:15:54,710 Not so straightforward. 191 00:15:54,890 --> 00:15:55,490 OK, guys. 192 00:15:56,630 --> 00:16:06,480 So we took care of the fact when this value is is is even which is not the case here. 193 00:16:06,890 --> 00:16:15,690 Basically, what we should take care of is also when this and Modula 10, the rightmost digit is in 194 00:16:15,800 --> 00:16:18,890 the basically I think I've done a little mistake. 195 00:16:18,890 --> 00:16:21,500 So just with these ones and zeros. 196 00:16:21,560 --> 00:16:28,390 So if it's an I told you, this exercise is not easy, you should be like very concentrated. 197 00:16:28,400 --> 00:16:33,230 And now I'm recording this video when I'm not in my fullest concentration. 198 00:16:33,590 --> 00:16:39,440 So if it's an even, we are going to return once a one relates to even numbers. 199 00:16:39,740 --> 00:16:48,620 So if it's in, it can be divided by two without a remainder, then it's an even number and the results 200 00:16:48,620 --> 00:16:51,140 so far equals to one meaning. 201 00:16:51,140 --> 00:17:00,080 The result is also even three for that then even plus even will result in an even result. 202 00:17:00,770 --> 00:17:09,410 Otherwise, if the result so far was equal to zero and it was all OK then in this case the sum of odd 203 00:17:09,410 --> 00:17:12,480 and even will result in odd. 204 00:17:12,680 --> 00:17:13,000 OK. 205 00:17:14,170 --> 00:17:23,410 Now, if we have an odd number here, OK, if the number is odd, the rightmost digit is odd and we 206 00:17:23,410 --> 00:17:30,550 also know that the result so far is even right, because it equals to one that was just in the comments 207 00:17:30,550 --> 00:17:37,120 and the the the final explanation here, there was this problem, if it's odd and even then the final 208 00:17:37,120 --> 00:17:38,230 result is zero. 209 00:17:38,440 --> 00:17:46,180 And otherwise, when the result so far was all the who then the final result of good. 210 00:17:46,360 --> 00:17:50,140 So let's just remove this one that it won't bother us. 211 00:17:51,120 --> 00:17:51,820 OK. 212 00:17:51,870 --> 00:17:55,160 OK, OK, so the results of the result, no problem. 213 00:17:55,860 --> 00:18:00,960 So we start with this simple question. 214 00:18:01,440 --> 00:18:03,930 Are digits OK? 215 00:18:03,930 --> 00:18:12,150 That what we what we want to find digits some even for one, five, six. 216 00:18:12,280 --> 00:18:14,760 So we want to understand what is this value? 217 00:18:14,770 --> 00:18:16,640 So we call this function OK. 218 00:18:16,680 --> 00:18:20,420 We call this function and equals two one five six. 219 00:18:20,430 --> 00:18:26,520 So the results so far are using these are short R if M is less than zero. 220 00:18:26,550 --> 00:18:28,100 No, that's not the case. 221 00:18:28,110 --> 00:18:30,570 So let's find out the results so far. 222 00:18:30,600 --> 00:18:36,240 Again, the results so far is basically the results so far from the left or the right. 223 00:18:36,390 --> 00:18:37,090 What do you think? 224 00:18:37,620 --> 00:18:38,310 Let's proceed. 225 00:18:38,460 --> 00:18:39,260 So let's proceed. 226 00:18:39,690 --> 00:18:41,040 Do not answer this question. 227 00:18:41,040 --> 00:18:44,690 If you are not certain, let's see how we can visualize it. 228 00:18:45,150 --> 00:18:52,320 So results so far equal two equals two digits, some even for an equals to fifteen. 229 00:18:53,220 --> 00:18:55,740 OK, so now we come back again here. 230 00:18:55,850 --> 00:19:02,700 This is another function instance and we ask the following questions. 231 00:19:02,700 --> 00:19:04,200 We don't know the results of. 232 00:19:04,500 --> 00:19:06,360 We don't know the results so far again. 233 00:19:06,360 --> 00:19:11,040 So we called these function four and divided by ten in these just one. 234 00:19:11,250 --> 00:19:20,010 OK, and here we already know the results so far is going to be returned OK and is less than ten and 235 00:19:20,010 --> 00:19:20,940 is less than ten. 236 00:19:20,940 --> 00:19:30,840 The value of end is one that in this case, if M is even that's not it, then we would have been returned 237 00:19:30,840 --> 00:19:31,950 one otherwise. 238 00:19:31,950 --> 00:19:32,840 We return zero. 239 00:19:32,850 --> 00:19:35,640 So from here we return zero. 240 00:19:36,000 --> 00:19:40,980 And where are the zero is going to be stored in the results of our value in this instance. 241 00:19:40,980 --> 00:19:43,020 So R equals to zero. 242 00:19:43,470 --> 00:19:49,590 The result so far is zero, meaning the results so far, ok is what it is. 243 00:19:49,950 --> 00:19:51,950 It's an odd number. 244 00:19:52,650 --> 00:20:00,210 OK, so now we come and proceed the running of this instance from this point. 245 00:20:00,240 --> 00:20:09,810 So if the rightmost element is even, does it even use five and even value the rightmost element so 246 00:20:09,810 --> 00:20:11,460 anybody will attend the rightmost? 247 00:20:11,580 --> 00:20:12,870 No, that's not the case. 248 00:20:13,170 --> 00:20:16,410 So we are going to execute this ls OK. 249 00:20:16,860 --> 00:20:19,590 And this is going to say the following thing. 250 00:20:19,950 --> 00:20:27,810 If the result so far was one and it's not meaning it's this ls will be executed. 251 00:20:27,810 --> 00:20:35,610 The results so far is odd and that's the case are equal to zero then in this case, taking into consideration 252 00:20:35,610 --> 00:20:39,150 that the result so far is zero, meaning it's in order. 253 00:20:39,540 --> 00:20:40,050 Right. 254 00:20:40,620 --> 00:20:50,370 The results so far, the sum of digits so far is odd, plus the current rightmost digit is also odd. 255 00:20:50,790 --> 00:20:59,160 Then the result should be one because all the plus odd equals two to what do even so, that's why we 256 00:20:59,160 --> 00:21:02,010 are going to return one to this instance. 257 00:21:02,880 --> 00:21:06,000 And in this instance we are going to proceed executing these. 258 00:21:06,450 --> 00:21:08,280 These are from these points. 259 00:21:08,280 --> 00:21:09,960 So R equals to one. 260 00:21:09,960 --> 00:21:14,130 That means we have the sum of digits so far is even. 261 00:21:15,930 --> 00:21:21,850 And we are going to ask if this the rightmost digit is even, does it even? 262 00:21:22,020 --> 00:21:26,040 Yes, it's six and it's even also even even digit. 263 00:21:26,730 --> 00:21:32,790 So we know that even the results of our equals to one meaning, if the results so far is even that's 264 00:21:32,790 --> 00:21:34,620 the case, then returned one. 265 00:21:35,290 --> 00:21:39,990 OK, so even plus even basically will return even. 266 00:21:40,140 --> 00:21:44,580 And that's going to be indicated by the value of one. 267 00:21:46,570 --> 00:21:56,380 Oh, OK, guys, so I think we've managed to kind of solve these difficult exercise together, once 268 00:21:56,380 --> 00:22:03,710 again, we took one, five, six, we split it up to smaller numbers, OK? 269 00:22:04,120 --> 00:22:13,930 And on every on every iteration, on every basically recursive call, we've compared the sum of digits. 270 00:22:14,230 --> 00:22:24,160 OK, basically, whether it was even even or odd so far, plus the rightmost element for these points. 271 00:22:24,170 --> 00:22:33,820 So we do here are the some so far was one OK, which was an odd number basically indicated by zero and 272 00:22:33,820 --> 00:22:36,610 every time we compare that with the rightmost digit. 273 00:22:36,650 --> 00:22:43,990 So here we compared it with five here we compared it with six because the sum so far was 15. 274 00:22:44,000 --> 00:22:49,720 And we calculated it on this later on this recursive call and so on and so forth. 275 00:22:51,910 --> 00:22:55,570 So, guys, I'm leaving to you this this example. 276 00:22:55,570 --> 00:22:59,590 Try to also build these blocks on your own, see what happens. 277 00:22:59,590 --> 00:23:07,810 Make sure that you understand every step and every like every every nuance in this exercise, because 278 00:23:08,320 --> 00:23:11,920 these is physically not so trivial. 279 00:23:11,950 --> 00:23:13,290 You have to think about it. 280 00:23:13,300 --> 00:23:16,750 You have to like to try to. 281 00:23:17,620 --> 00:23:17,950 Yeah. 282 00:23:17,950 --> 00:23:24,130 At least one or two exercises to do like this to make sure you understand everything to the fullest. 283 00:23:25,050 --> 00:23:31,590 So with that being said, of course, maybe I will even create additional exercise of just some odd 284 00:23:32,030 --> 00:23:37,800 OK, but there is no much things that should be changed, but I will think about it. 285 00:23:38,410 --> 00:23:40,050 So thank you. 286 00:23:40,050 --> 00:23:41,820 And I will see you next time. 27127

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