Confused about this
-
This post is deleted! -
I'm so confused
[Originally posted in Discussions]
I'm not sure what you're confused about, is it the challenge problem or the mini-question at the end of the video?
It might not look like it, but the problems are very similar! In the challenge problem, we wanted to count up all the 3-digit numbers, except those that are like 111 or 999. Those guys are the bad guys! We don't want to count them.
As Professor Loh showed, there are a total of 900 3-digit numbers, right? Out of those 900, there are 9 "bad" guys. They are: 111, 222, 333, 444, 555, 666, 777, 888, and 999. Since we don't want the bad guys in our count, we have to remove them from the 900 numbers, so that's why the answer was 900 - 9 = 891.
In the question at the end of the video, the "bad guys" are different! This time, we don't want to count numbers whose digits go up by 1 each time, or go down by 1 each time. So, 123, 234, 789 are bad, and 210, 321, 987 are also bad. Can you count up how many bad numbers there are?
For the bad guys that go up, they are 123, 234, 345, 456, 567, 678, and 789. 012 is not a bad guy, because it's actually just a 2 digit number (and we aren't looking at 2 digit numbers in the first place!). You can see that there are 7 of them. A quick way to figure this out is by looking at the first digit: It goes from 1 to 7.
For the bad guys that go down, they are 987, 876, 765, 654, 543, 432, 321, and 210. That last one might have been easy to miss! This time there are 8 of them. You can just count them up, but a cool trick you could use is to see that the first digit goes from 9 to 2, and you can do (9 - 2) + 1 = 8. (Can you figure out why this works?)
That means there are 7 + 8 = 15 bad guys in total. We don't want to count them, so we have to take them away from the 900 3-digit numbers that we want to count. So we do 900 - 15 = 885, and that's the answer.
Hopefully that cleared up your confusion! If it was something else that you're confused about, or if you're still confused, please tell us right away and we'll be sure to help.
Happy learning!
Thomas
The Daily Challenge Team