 What's up, guys? Mike Dakota here. Today we're going to go over the next problem called bit strings. This problem is significantly easier than the other two, but yeah, let's go over it. So you're given a number n, your task is to calculate the number of bit strings of length n. So if n is equal to 3, the correct number is 8 because the possible bit strings are 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1. Okay, this problem is very easy. So there's two things you need to know. Two things you need to know. Okay, so let's say we have, I don't know, length n is equal to 3, right? So here in this case, n is equal to 3. So there's three places. And remember, bit strings, you could have possibility of 1 or 0, right? So there's either 1 or there's 0. So the two possibilities you could have, the total possibilities is 2 then, right? So then we would just have 2 here. There's two ways to put it here. And it's the same thing. There's two ways to put it on the second bit also, right? And then there's another two ways to put on the last bit, right? So n is equal to 3. So our total answer in this end would be 2 times 2, which is 4 times 2, which would be 8. And that's the answer, right? That's the answer. So yeah, n is equal to 3. There's three places. And for bit strings, you could either have a 1 or a 0. So there's two choices for each of them, right? Two choices for each of them. Okay, so essentially is if you have, if you generalize this for like n equal to like 9 or 10 or whatever, the answer would just be 2 to the n, right? 2 to the n. It would be your answer. Okay, so the hard part is this problem is that they want you to print the result modulus 10 to the 9th plus 7. Okay, so the hard part is that this number will get overflow. And you want this number to mod 10 to the 9th plus 7. Okay, so you want to print this to the number to mod 10 to the 9th plus 7. So this is the answer, 2 to the n mod 10 to the 9th plus 7. You're going to get an overflow sooner or later. So basically what they want you to do is that you want to use this property of modulus. So if I explain what they mean is that, so let's say I have like x is a number and y is a number, right? Both of these are numbers. So if I take 3, I don't know, x is a number, y is a number. If I take x times y, and I do a modulus mod by like z or something, right? Remember, mod is finding the remainder, finding the remainder of the number, right? This is equivalent to doing x mod z times y mod z. Okay, and then you could, yeah, this times that, and then you could mod again mod z, right? This is a property you could learn for modulus. x times y mod z is equivalent to x mod z times y mod z mod z. Okay, so, yeah, to do this problem, once you know this property, you know 2 to the nth is equal to 2 to the n mod by whatever this number 10 to the 9 plus 7, right? So you know this is going to overflow sooner or later. So what you're going to do is you're going to actually use a for loop and you're just going to separate this into like individual 2 mod 10 to the 9th plus 7, right? You're going to do this and you do times 2 mod 10 to the 9th plus 7 and then you keep on going so on and so forth until you get to n, right? Do this n times and then the end you could just mod by 10 to the 9th plus 7 and that'll be your answer. That's essentially the gist of it, right? You're going to do this n times so then you would get, in the answer, you would get the same answer. So, yeah, the code is very, very easy, super easy. Read in the number n and then let's create a variable. Let's call it x. I use long, long because I don't want to, ll means long, long, okay? So long, long x is equal to 1. I'm going to loop from 0 to n and every time I'm just going to multiply it by 2 and I'm going to mod by this number mod. I create a variable called mod. It's a constant. It just represents 10 to the 9th and I just wrote it out 10 to 9 plus 7. So, 10 with 0, 9s and then 1, 7. That's a variable mod and I just use that and every time in this for loop iterates I take x and I equal to x mod this mod and in the end I just print out x. So, yeah, this problem is very easy. There's nothing else to it. Just make sure that you understand the mod property and then this is super easy. Rate, comp, subscribe. I'll check you guys later. Peace.