 What's up guys today? We're going to go over another problem called a game with numbers This is called a a game with numbers NGM. Basically Nick and Tofford playing a game They have a number that's smaller than 200 million and we each take one turn, right? Nick is the first one to do his first turn. The turn is basically You subtract any non-zero digit is subtracted from the number and then a new digit the remaining Value replaces old one. So for example the integer 405 34 you could subtract 4 from it and you get 405 30 Or you could subtract 3 from it and you would have 405 31 or you could subtract 5 from it And you would have 405 29 so the winner of the player is the one who writes zero on the desk So that's like the last player who writes zero, right? So Now basically we're just gonna decide a program who will win if both players do their best Okay, so the gist of this problem is actually not that difficult Basically, they're saying that we need to subtract any non-zero digit, right? So what are non-zero digits for like for each move? We have to subtract non-zero digit So what are the non-zero digits non-zero digits are digits between zero to nine, right zero to nine So basically each move we're gonna subtract digits from zero to nine, right? So if the number is divisible by 10 So like 405 30 no matter how many times I subtract a digit from zero to nine I'm never gonna have a digit that's divisible by 10 right Do you guys get it so then I would always lose? Right if I if Nick goes first he was always gonna lose then if the number is divisible by 10 otherwise If it's not divisible by 10 what we could do is we could just keep subtracting the last digit over and over again So like we have zero four zero five three one, right if I subtract the last digit one It would be four zero five three zero then I could subtract the next last digit over and over again And then sooner or later. I would get I would get the answer, right? So basically the gist of this problem is just to I'll show you the code now That's pretty much the logic of the problem So all we have to do is just check if it's if we read in the number n We need to check if it's divisible by 10. So if it's not divisible by 10 Well, then that means we won we're gonna win right because we're just gonna print out the last digits We're gonna just keep distracting a number from zero to nine and then in the end that's just gonna be the last digit That's divisible by it. So if it's not divisible by 10 then we print out we win and then we print out Uh, our last digit the ones place digit Otherwise we're gonna print out Otherwise, we're just lost because no matter how many Non-zero digits from zero to nine that we subtract we're never gonna get back to a number that's divisible by 10 So yeah, I hope you guys enjoy this problem. Ray come subscribe I haven't had the time to do a lot of problems these days Doing tutorials. I mean, yeah, it comes to describe. I'll check you guys later. Peace