Digit DP is a dynamic programming technique used to count numbers satisfying specific digit-based constraints within a given range. The technique involves breaking down the problem by digit position, tracking constraints like previous digits, and using memoization to avoid redundant calculations. For the problem of counting numbers where the absolute difference between adjacent digits is at most K, the solution requires tracking the previous digit and the tight constraint (whether we're still bounded by the upper limit of the range). The approach handles leading zeros carefully and computes the count for the upper bound minus the count for the lower bound minus one to get the result for the range.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
LeetCode practice July 15th 2026
Added:Microphone check. One, two.
All right.
Are we live?
I think we are.
All right, here we go.
Leak code daily problem. Oh man, more GCD. Wasn't the last one? GCD.
GCD week, huh?
Apparently, I saw this not too long ago.
Dang, three, four months.
Sum of GCD of formed pairs.
You're given an integer array nums of length n. Construct an array prefix gcd where for each index i, let mx be the maximum of all the numbers up until that index and prefix gcd equal the gcd of uh nums i and the maximum of i.
After constructing prefix GCD, sort uh prefix GCD in nondereasing order.
Form pairs by taking the smallest unpaired elements and the largest unpaired element.
Repeat this process until no more pairs can be formed. For each form pair, compute the gcd of the two elements. If n is odd, the middle element in the prefix gcd array remains unpaired and should be ignored.
Return an integer denoting the sum of the gcd values of all foreign pairs.
I don't know what that just said, but I'm going to look at the example. So 264, the answer is two. Prefix GCD.
Max is two six two.
This is an easy problem. Um, first let me make my prefix GCD.
What are the numbers up to? Only positive numbers. So, this could be zero, I guess.
Um, wait, what's what the heck is the prefix GCD?
um gcd of nums eye and the max. All right.
So we have to keep track of the maximum.
So now iterate through keep track of the maximum and then the GCD is equal to how does a GCD work? Is it like GCD like that and then we pair them ups or they say sort sort this thing in nondereasing order. So that's just a regular sort.
And then I'll do a little twop pointer while loop.
Um, and then what are we doing?
Smallest, largest, and then the GCD of those two.
prefix gcd l or I guess we can minus - plus+ plus and then make an answer sir. Sir Lord good. What's happening?
How are you doing?
All right, let's see.
Is that going to work?
That was pretty easy.
I don't know why it's medium.
I guess it's one of the easier mediums because there's nothing. I basically just did exactly what they told me to do, man.
What the heck is that noise, man?
Is there a fly in here?
That's a bee, man. How the hell did a bee get in here? What the [ __ ] I got to Oh [ __ ] What do I do, man? How did a bee get in my basement?
Anyways, um horshit, what's happening? And Zen Logic, what's popping, man? How's the trip? Trip was bumping, but it's over now. Time to get back to work.
I'm worried about this bee in my basement, man.
I think it stopped. Getting the raid spray now. He can't kill bees, can you?
I guess he could.
Trying to stay consistent with my elite code. Um, what's it been like for you?
Have you been skipping days? Has it been a struggle?
Have you been at least doing uh the daily problem every day?
I'm not super consistent with le code, man.
I am not very active, I guess.
I go through phases where I don't do anything. I think that's quite normal.
But I'm not like preparing for interviews or anything.
It's been hard, but I've been doing the dailies. Yeah, I think doing the dailies is like the bare minimum. I don't think you're going to get much better by just doing the dailies, but at least you won't get any worse, you know.
Um, is it time to do a virtual contest? Topics and weak on our DP. Yeah, DP.
I promise, man. I was scared of DP problems for at least a year and a half, maybe more.
Um, but now I think DP is like I wouldn't say my favorite topic, but some DP patterns I enjoy trying to figure out how to solve them, but it took me a while to get used to it, man.
Took me a really long time to get onto DP problems. matrix array manipulation and math. Yeah, math is always tough for me because I'm not very strong with my um certain maths in particular. I think combinotaurics and statistics and all that stuff.
Um matrix problems depends on what they are. If they're like a matrix graph, I'm all right. Hey sir Lord, good. It sounds like there's a lot of topics that you got to work on, man. I'd say instead of worrying about the daily too much, I think the streak is maybe important mentally to keep.
I don't think I care about my streak anymore.
But if you want the best bang for your buck, um, focus on these topics that you just listed out here, man. The topics that you're weak on. Maybe not so much DP because I think, well, I don't know.
five years ago. Um, people say DP is like not really asked too much in an interview, but I think in today's world DP is probably asked.
Uh, Fluffy, what's happening, man?
How you doing?
Gonna join an MLM.
Hey, you can make some money if you get a lot of people under you. Which language is this? So I usually do C++.
I guess you can make a lot of money if you are good at recruiting.
Anyways, um let's see which virtual I got to do.
508.
Man, I hear the be buzzing.
Um, I guess 507.
507. Here we go.
Am I ready for it, man? I'm not sure.
Panama mention 507. That's your country code. Dang, I didn't know that.
Very nice.
Is it a random number or is it every contest is 507?
Let's see.
509.
50 510.
So, I guess it's not the same every time. Which one we're doing? 507.
Oh, if you come the number of the contest, you get the dang notebook.
All right, I'm ready to begin this virtual contest here. Let me link it if anybody wants to do it alongside me.
Here we go.
Maximum Manhattan distance after all moves. You're given a string moves consisting of the characters up, down, left, right, and underscore.
Starting from the origin, each character represents one move on a 2D plane. Up, down, left, right, underscore can be independently replaced with any one of up, down, left, or right. return the maximum Manhattan distance from the origin that can be achieved after all the moves have been performed.
H I think um I think I should add up all the up all the north south direction and left right. So, I'll keep those coordinates as horizontal or something H and width. Or should I use R C? I don't know.
I don't know what to use here, man.
Uh, I guess I'll use R and C.
So, I'll iterate through all the characters and I'll count how many blanks I got.
Um, I I don't really know what I'm doing yet, but I think counting where the position is and then deciding whether to fill them left or right or whatever.
So, all right. If this is up, down.
This a bad way to do it. Left, right, underscore.
All right. So, if it's up, I'm going to decrement our row.
Uh if it's down increment left decrement column right increment column and if it's underscore increment my blanks.
So I guess I should just calculate the Manhattan distance and add the blanks.
So it just be because since we can put the blanks anywhere, we can easily just move one distance away for every blank from the center from wherever we are.
Oh, at least that's what I'm hoping.
ABC three. Uh oh. How am I get three, man?
Left and down, man. That should be 1 + 1 + two.
How am I going to say three left?
Let's see what's happening. Man, I should be able to spot the bug with my eyeballs, but I'm uh down.
How the heck?
L.
Oh, I put R. No, R is good.
L. So L is good.
Down did not do anything. Man, isn't that crazy?
It might be crazy.
Am I tripping right now?
Right.
Some man, I can't I can't see what I'm doing wrong.
Maybe because I'm blind. All right, let me look one more time. So L.
Wait, which one is wrong? Um, my left and rights are wrong.
So if it's an L, decrement the column.
But that didn't even happen, right?
This contest is going real bad. Brent aretta, what's happening?
What am I doing wrong? Brent, cuz something ain't right.
It's crazy talk.
How is C?
Oh, because I have Jesus Christ, man.
It's because I have C uh double declared there, man. So, I'm going call this big C.
What terrible code?
How embarrassing, man.
All right, I'm gonna send that.
Oh, Jesus.
Um, all right. Q2, valid subarrays with matching sum digits.
You're given an integer array nums and an integer digit x. A subarray is considered valid if the sum of its elements satisfies both of the following conditions. The first digit of the sum is equal to x. The last digit of the sum is equal to x.
return the number of valid subarrays.
This one is interesting.
1,500.
So, am I just checking every single subarray?
Um, can I do an N squ there?
Should I try?
I brute force or am I tripping?
How do you do this? I + one.
No. How do you do every single That's every single pair is like every single subarray.
And then I I just add the subarray.
And then how do you tell if it starts with that number?
H.
Let me think about that.
I could like put it to string, but I don't know if that's the move I want to do right now.
Um, and X is one through nine.
So I'm trying to figure out if it's faster to do like if some mod 10 equ= x and can do that seems a little bit sus.
But I'mma try it.
Zero. Maybe it doesn't like this thing.
Um, some mod 10 is the rightmost digit.
And then only if that's true then I'll check the string.
Oh, I know why. Because now it's a character. So it should be either I can do this or Yeah, I'll do it that way.
four zero. Should I send that man? Is it going to be fast enough?
Is converting it to a string faster than just dividing out until the last number?
We'll find out right now.
Oh, it's fast enough, man.
It's too fast. zero milliseconds fast.
All right, next. Um, shortest path with at most k consecutive identical characters.
You're given an integer n representing the number of nodes in a directed weighted graph numbered from 0 to n minus one. This is represented by a 2D integer array edges where edges I equal U VW represents a directed edge from node U to node V with weight w. You're also given a string labels of length N where labels I is a character assigned to node I and an integer K.
return the minimum total edge weight of a path from node zero to n minus one such that the concatenation of the labels of the nodes along the path contains at most k consecutive identical characters. If no valid path exists, return negative one.
Is this a dystras problem or is it something else?
This modified dystras. Not sure yet. So, we know it's single source, shortest path, weighted, but you can't go three labels in a row. I don't know.
I don't know how to check that. Maybe the dyra also need a label.
Let's see.
It's a lot of edges, man.
How many nodes is that? It's like 50,000 nodes.
I guess we don't really we don't need the whole label path. We only need the last two characters in the label path.
So that can Yeah, I think I think if we just store the last two nodes label in our dextras and then we just ran regular dystra, we can do this problem.
But I don't know how to do dextras. I've forgotten.
Uh, let me try.
So, I know I'm going to need usually I need a pair int, but I know I'm going to need something else.
And I'd like to use a tpple or tupole, however you say it. But I always hate looking up the syntax for things. So I'm just going to use a pair ints pair string int pipsy. Yeah.
Pair int pair string int. Yeah. I'm going to use a pipsy.
Wait, can I do that though?
I'm going to try. I'm going to try.
Um, what do I need to do? I need to make an adjacency list.
I also need a distances and I need a priority queue.
Can I use parts Q uh with greater like that?
We'll find out.
And we start from zero.
So I'll just set my distance at zero to zero. And then in my prior to Q, I will push a pair with the weight starting at zero.
and uh empty string as the label and zero as our node.
Negative IQ viewer, welcome to the party. I am back.
I'm back.
I'm back for hopefully the rest of the year.
I have a wedding to go to in two months in September and no other obligations.
Is their holiday good? Yeah, I think it was a great time off.
Um, but now I'm ready to grind. Grind for real.
I don't think I've started to grind yet, man, but I think it's about to happen.
What country did you visit? I went to Taiwan, uh, Korea, Japan, and Jamaica.
All right.
No way. Yeah, way. For sure.
Um, it's a lot of places. Yeah, I'm going to Korea and Japan soon. Dang, that's bumping. Was it good for sure? It was good, man. I don't think you can go wrong with that many nice places.
When are you going, negative IQ viewer?
And have you been before?
All right, let's see. I want to say this is my weight and this is my other info.
And then I guess we can do like um current label and node like that. Yeah.
So I don't know what I'm trying to do, man.
I got to make my adjacency list. I forgot to do that. First time. Dang.
It's going to be a good time. I have a friend that is going to live there for some time. So when he will be in place there with his home and stuff, I will join for some time. Your friend is going where? Korea or Japan or both places.
All right, let me make this agency list.
It is a directed weighted graph.
So that means we just push back.
Where do we push him back?
Uh we're pushing back the the weights and then we're also pushing back.
Ah, this doesn't need any label, does it?
I guess this could be H. This is getting a little weird.
I guess I guess this one the adjacency list I don't I already have the labels elsewhere so it could just be um the weights and the node elite whale Hello. How you doing, my friend? What's popping? Korea because flights are cheaper and we'll visit Japan after. Anyway, that's good. Now, I might ask you some questions about Korea if I have any. Hey, I'm no Korean expert.
I'm more familiar with Japan than I am with Korea. Anyways, negative IQ viewer.
Take care, man. Thank you for popping stopping by popping in.
Um, what was I trying to do?
I'm in my JC list.
I have my priority queue and just do that lazy thing. Now I'll iterate through all the children in the adjacency list. So what's in there?
The child weight and the child node.
And we take the new weight. So we have to do a few checks here.
Tomkins, what's happening?
Any reason for the leak code grind or just for funsies?
I'd say I wouldn't call it a grind.
Um, yeah, maybe just to keep my brain sharp. It's kind of just for mental stimulation, I guess.
H um but I started out doing le code five, six years ago, seven years ago because I wanted a job but now I don't really want a job but I still do leak code because it's kind of become a little bit fun you know it's like a very high skill video game in some ways or just like a puzzle game to Blue cactus AI. What's popping? Sharp as attack. I don't know about that.
All right, let's see. New weights would be equal to the child weights plus our current weights. And if our new weight is less than our distance to that child node, then we should try this.
But not only that, we also have to check like the label.
Um, how do I do this?
I couldn't. All right, it's going to look ugly.
If the label I'm going just call this I don't want to type current label every time. So I'm going just name it L.
uh labels child then continue. This means it's like three things in a row.
So maybe I should like say continue here.
But should I always continue if it's equal? Maybe I should just use greater.
And I wonder if I have to remember the labels because I don't know yet. I'll just solve it and see what problems I run into. But I guess there could be a case where the distance to a certain node is the same, but the labels getting up to there, the last two labels are slightly different.
And maybe choosing one path over the other is better, you know? So, I don't know if like we should just skip it if it's equal.
Anyways, um let me see what else we have to do. I have to push this into the priority queue.
But the priority Q is up here with the weight first. The weight always goes first because that's what it gets sorted on.
And then uh the new label would be I put L2 and I will put new label.
Um, so the first thing becomes that and that becomes the current label.
So, I guess we'll put the node here, the child node.
All right.
Uh, Stephen Lf, what's happening? How's it going? Yeah, it's going good, man. Good to see you.
Um, all right. I think that's all I'm going to do, man. Oh, wait. I have to update my distances.
Maybe that's it now. So, Oh, it compiles but it's not right.
So I got example two is two, example three is -1.
That ain't right, man.
How is that zero?
So there's um 0 to one and then one to two.
So this goes zero.
Oh, you know what?
You know what's wrong? This is wrong.
This should be This should be This should be like that, I guess, because it doesn't start blank. It starts from the first node.
So maybe that's where something's going wrong. Let's see.
No, example one's still incorrect.
Example two is okay. Example three is incorrect.
Oh, I guess this part uh could be a little bit sus.
H.
It's getting sloppy.
Super hacky band-aid code.
So, if it's two, I should do that.
If it's one, which I assume it's one right here.
I'll do that.
All right. Negative one.
All right. The first test case is not great, but I fixed the third one, so it returns negative one.
All right. Let's see why this one is failing. So I'm saying the answer is two, but it's not.
So we got zero to one. All right, let I haven't done much asy art for graph drawing, but let me try real quick if I can do it.
So I got zero to one.
I guess this one isn't too crazy. and uh one to two and then dang how am I going to draw zero to two I guess like this or something.
Oops.
That's good enough, right?
Uh so this weight is one, this weight is one and this weight is three.
So they're saying wait how zero to two.
Okay. Oh, because it's not Dang. My bad.
I kept thinking um last three like three consecutive, but it's not three consecutive. It's K consecutive. Man, I just did all that junk. Oh, but K's only 50.
I have to modify a lot of things. I think most things are okay, but I don't know why I forgot K was a variable here.
Why? I kept thinking three in a row. I don't know where that came from. But if I had to modify this, the first thing I'm thinking is maybe I should not use a string as my label.
I hear the B again.
Maybe I should use a deck or how can I do this right?
No, I think a string is good. I think a string is actually real good because then I'll do this. This is some bootleg stuff.
So, I'm going say this this part is bootleg, too.
So all right, let me just put things down here. Check if last K are the same.
So this is my check. What I'm going to do, I'm going to take the label length.
I'm take the size of the label and then I guess I'll keep k minus one in there.
So if the label size is k minus one and whichever l0 is equal to the child label then this is k in a row and we should continue and then when we're printing the new label I'm going to say um if if the child label is equal to our old labels first character Then then the new label is just the old label with one more otherwise I guess I could just put this here and then eliminate that and maybe it should be all right now.
Oh, still not right.
Wait, why is this test case not? Oh, wait.
Because K is one.
That means we can't go from one, you know, that thing to that thing.
So uh right here label size is not k minus one.
Oh k equ= 1 is like an edge case for me with my code. Let me think because here I'm checking the label size is one.
Maybe I say if it's greater than k minus one then we got problems.
All right, there we go. Three 2 andgative one. Uh, should I send it?
I guess why not, man?
Time to exceeded.
Come on, man.
What does that mean? It's too slow.
Yeah, that means my solution is too slow. And I think my problem is right here. I'm copying this old label.
Um, but I'm not sure if I want to copy everything cuz I only need I think this is my problem for sure.
copying the labels like that. I only need the last K. It seems like this test case was designed to fail me, but K is one here. So, this label should just be a single character like almost every time.
I'm going do something funky.
It's gonna be real funky, man.
No. No. I'm not going to do it. It's too funky.
I'm going just be like um What am I trying to do?
What am I trying to do, man?
So, that's the end.
So, I'm trying to go from This is a little strange for sure, but I think it will work.
Use this test case only.
Come on, man.
Something ain't right right here.
What could it be?
I think I'm real close. Zero.
Oh, yeah. Yeah. Yeah.
I see what's happening.
very sloppy, but maybe it will work.
Maybe it won't. Time exceeded still. All right, what else could be the problem?
All right, my next guess is maybe I can do that.
That's creating a copy every time.
Um, still not great.
What else can I do to speed things up here?
Oh, wait. Let me look at the inputs. The sizes What else can I do, man?
Maybe can I use a deck instead of a string so I can like pop fronts or something?
Holy whale. You think I should do greater than or equal?
You know, I purposely did that, but Oh [ __ ] Maybe I shouldn't have. Dang. How the hell? I was thinking because of the labels thing, you could reach a node and match the distance, but your last labels are different, you know, um, and it could lead to a different answer, like an answer that is correct versus I don't know if you know what I'm saying. So that's why I didn't do gray and or equal here.
Um, okay. There. Okay. There will be a bug.
All right.
So maybe this is Wait, which did I get this test case?
All right. So maybe I have to do something besides maybe I have maybe it has to be like distance and the label at that distance needs to match otherwise you try it again.
But why would this one fail?
because I don't know 0 to one one to two so it should not be able to reach I swear this isn't this the thing yes so when I do that for some reason uh get channel. Thank you very much for that. Hydrate. Cheers.
Yeah, Elite Whale is always there, man.
Oh, we need him the most.
Um, wait, how did that change things though?
Maybe something else broke.
Oh jeez.
Let me erase this one.
So something else broke when I introduced whatever label size thing.
How did I mess it up?
So I start with the A label.
And then so the label size coming in for the first time should be one and label size greater than greater than equal to Maybe.
All right. So, Leet Whale says there's still going to be a bug. I'm going to submit knowing that it's going to break anyways according to Leit Whale, but also we sused out um we sused out the problem before.
You're right with your intuition about needing more for the distance state.
Right now, your state is but you can have a more efficient state. Yeah.
Wait, my states is well, my distances state is kind of just a number, but I think I hear what you're saying.
Um, I'm going to have the distances be I don't know, man.
I'm not sure.
You're just using node for distance, right? Your state is really iron node.
All right. Yeah, I see what you're saying then. Like, yeah, my distances thing is just int, but I actually keep the label inside here. And I just check the label like right here.
But there's a way that we can check probably both or more efficient.
I don't know how to combine those two into one state.
If I was a caveman, what would I do?
I would I'm trying to think.
What would a savage like me do?
I was going to see if I can do like some type of unordered map and make some bootleg key with like the distance and stuff, but maybe that's not great. Um, so I know the label is important and the distance is also important.
But instead of a label, maybe we can have Like we don't actually care what the label is.
We only care about how many consecutive characters there are.
Yes, we don't we don't actually care what the label is. So maybe maybe something like just keeping counts but I don't know how to implement that.
So instead of having the starting label like that of like starting streak or whatever or whatever.
I mean I could just put one there too but I just want to make it explicit that it is the starting streak.
So if my streak is greater than equal to K, I should continue.
And then wait, maybe I can be like if streak plus what do I call them? Labels.
It's too many parentheses.
But if that is greater than equal to k continue and then this can be an int.
And then what do I do here? We don't need a new label.
Um, we can just say we can just check if they're equal.
Man, that bee is in here, man. Buzzing around. I hear it.
All right. This is a little bit better and representing uh our state and what we care about, but I don't know if it's going to fix whatever problems we had here.
Start label.
I don't need that.
Ammo NB, what's happening? That's you.
Hey, buzzing around real loud.
Um, I don't know what's what here.
Test case. Everything's wrong one.
Wait. Re reset test cases, man. How do you reset them?
Jeez.
I don't know. I don't know how to Let me refresh. Maybe that will help.
Oh, reset test cases.
Uhoh.
Negative one. Huh?
Oh, I see. I see. So, this check the streak is already one.
Um, so maybe it should be greater than K. All right. 3 2 1. All right. I'm going to submit this, but I feel it's still not fully right.
All right. Time exceeded.
Oh, let me put that part back in.
I'm going to have so many wrong submissions on this thing, man.
All right, one more submit. Even though I'm pretty sure it's not right.
All right, here we go. This is the test case that we've wanted to find. the test case that probably says something about uh this part being wrong where if the distances maybe I need to check that the distances and um the streak or something you know you know what I'm saying so I have distances there.
But how do I do that other part?
Maybe I have to do like a streaks.
Uh yes it's like when you do DP you have to include all the necessary parts of the state child by itself is not enough to represent the current state hold on elite whale let me think about what you're saying include all the necessary parts of the state you mean like when you're looking in the fresh the child by itself and I I'm using the child.
Yeah. So my distance is kind of like my cache.
So you're saying I'm going to need to put like of one more dimension here which is and then it should be of child sizes and then of K sizes um or something whichever um which one's the the bigger ones on the outside and the smaller ones in the middle or the bigger ones in the middle. I forget which way, man. I think the bigger ones in the middle.
If I think about it, I can get it. But I'll just start with this. So, we're going to check streak.
I'm going just do a plus one for good luck. Maybe a plus two.
Should I move that down here when we capture the new streak instead?
I'm not sure, but I think we could try.
And then a streak of one maybe. I don't know what's put there. 0 0 1 0. Who knows?
How do I know if we reach?
Who knows?
What do we return here, man?
The minimum of those distances.
Dang. How do you do this, man?
Because should I have swapped them?
Um, I guess it goes to K + 2.
This is some real bootleg thing.
This is real bootleg, man.
Let's see.
I don't think I got the right answer.
The first time you pop node N minus one from your priority Q will contain the shortest distance to reach node N minus one. So, you can return as soon as you hit node N minus one.
Oh, that that makes a lot of sense.
But my answer is still wrong. Oh, let me see.
This problem is too hard. Leap whale.
See, I'm getting the wrong answer. still expected 527.
Let's make sure.
Oh, maybe it's a different test case.
Oh, look at that. It was a different test case.
All right. Thank you very much for all that help, Elite Whale.
Yeah, I think I saw everything there. I just wasn't sure how to implement correctly, especially with the distances thing like that. I I don't think I've ever done a distances like a 2D distances like this, at least not in recent times.
Interesting problem.
Decent dystras, a little bit challenging, man. Can you guys hear that B?
Sounds like it's right there.
Just got to make sure to include the whole state. Like a DP problem. Yeah, I guess Dextras is kind of like DP, huh?
Would you say so? Yeah.
Um, should I try Q4?
I ain't too sure about Q4.
Maximum total value. You're given two integer arrays, value and decay, and an integer M. Value I represents the initial value at index I. Decay I represents how much the value decreases after each selection of index I.
You may select any index multiple times.
The total number of selections across all indices must not exceed M. If you select index I for the tth time where T is one indexed, the value gained is value I minus decay times T minus one.
Return the maximum total value you can obtain. Since may be large return mod.
What are they asking man?
So we have these values initial value at index i and decay.
Okay. How much time it decreases.
And we can um we can take m selections.
What is the maximum?
Interesting problem.
10^ the 5th n is equal to 10 to the 5th.
Um.
All right.
So, obviously selecting the largest number first is probably a good choice.
But how do you this a greedy problem or something else?
Um, all right. Say this one then it goes out to four.
It's like a priority queue problem.
It's a hard problem. So I don't want to like think it's technique is too simple like you put all these into part Q along with their indices.
You just pop M times and then you subtract and put them back in.
Oh, M is a billion. Yes. Yes.
So, we can't just party a billion times because that ain't bumping.
So, what the heck are we supposed to do?
And M being a billion is crazy cuz every solution, all right, the most obvious solution to me is the priority Q thing where you put all these numbers in with their index and as you pop them, you add them to their total sum and as you put them back in, you subtract the decay.
But with M being so large, that's not feasible.
So what else can we do?
Um maybe we can do something with the decay.
Like we can calculate how much each thing maybe some like division or something.
Can see that we can take like this many times.
All right, Lee Whale, can I solve this problem or is this a technique that I don't know?
It feels like it's some like some techniques I know I could maybe use, but I don't know which ones.
Is this like a math problem?
I didn't solve this one. Dang.
If you can't solve it, man, I for sure can't solve it.
Um, sounds a little bit tough with M being so large.
Maybe some crazy technique that I don't know yet.
All right, maybe that's where I stop for this contest at least.
Maybe you can clap its cheeks. I'm not trying to clap any problems cheeks, man.
Let's see what it's saying, man.
Man, look at all those hints.
I'm read I'm read the topics.
Greedy math.
Yeah, greedy problems tough. Math problems even harder. They also say binary search. I was trying to think how the hell can you binary search that?
Especially with it this mod thing.
Like definitely not binary searching on the answer, but maybe binary searching on something else.
Unsure.
Unsure. But I think I will move on to another. Let me do one more virtual today.
See how we did on that other one. Not too great.
Dang. 507. Man, look at these ranks.
It's not binary searching on answer.
It's binary searching on something else.
Yeah, seems a little advanced for me, man. If I was still taking contest, I think I'd do really bad. I don't even think I'd be a knight anymore, man, if I had to take contest in 2026.
Um, all right. So, 185, maybe by weekly 185.
Yeah, let's do that one.
Um, all right. Here we go.
Am I ready?
I'm not ready.
All right.
Is that a new Fitbit? That is the Fitbit Air.
Let's bump it. I like it. I've only had it for a few days, but it's like I don't even feel it, man.
I can sleep with it on. It doesn't feel like anything.
It's real easy. I've had smart watches before. I can't sleep with those things on. I've had regular watches. I also can't sleep with those on. But this little Fitbit Air is nice. Also had the Aurora ring, but I gave that up. The ring was too big and I didn't feel like paying that subscription.
Sorry, I guess got this Fitbit error.
All right, here we go. Create grid with exactly one path.
What you're given two integers m and n representing the number of rows and columns of a grid.
Construct any n byn grid consisting of only the characters dot and hashtag where this is a free cell that's an obstacle.
Uh return a grid where there's only one path.
All right.
Um, how do you do this size M?
How do you how do you create a string in place? Is it like that?
Let me see.
All right. It's okay. So, I'm going to just fill everything up with hashtags and then I'm going to just go from there and I'm going say row column is a free space and then I'm going go from what am I doing That's one single path.
I guess I can't look at the answers, but I they say any path.
We'll see.
Too easy. Next question.
Minimum lights to illuminate a road.
You're given an integer array lights of length n representing positions zero through N minus one on a road. For each position I, if lights I equal V, where V is greater than zero, there is a working bulb at position I that illuminates every position from the max of zero and I minus V to the min of N minus one I + V.
So basically plus or minus V in those directions.
If lights I equals Z, there is no working bulb. Position is visible if it is illuminated by at least one working bulb. You may install additional bulbs at any positions. Each additional bulb installed at position J illuminates positions from J minus one to J + one. Return the number of additional bulbs required to make every position of the road visible.
Okay. Um, how am I going to do this problem?
I hear what the problem is saying.
So, I need to like illuminate everything. I wonder if I can do like a multisource BFS.
Um, multissource where I add all of the light bulbs in there and then I just BFS like they all illuminate the cells that they go up to.
I think I can do that and then go through and then put down cells. But I got a P. Hold on. Uh, Ren Zeneskirts, what's happening? When you're not in a contest, do you look up a solution if you get stuck for over an hour or do you keep trying until you get it? I usually don't get stuck for over an hour, man, because I'll give up around 45 minutes or so. Um, but I usually don't really care to look up that much. But I'm also not really preparing for an interview.
I'm just doing this for fun. But I'll be right back. I gotta pee.
All right, here we go.
Um, what was I trying to do with this problem?
Multisaurus BFS.
Um, I don't think that's going to work.
Man, is this problem card.
So, there's no lights.
All right. So this one, how do I know?
Am I overthinking this? Let me look at the constraints. So there is 100,000 Um, and the lights number can be up to 100,000.
I guess I could visit each light mark all the lights I get covered.
But there are some cases where that might not work. Like if they gave us a 100,000 all the lights, you know, that would be TLE.
So what else can we do here?
Maybe some type of stack or maybe like a go from left uh from right like left pass right pass.
So if you pass left, left to right.
I don't know, man. This problem is not that straightforward for me.
So if it did a left pass, we'll see that this is lit up. All right, I'll use 0 0 and I'll put the the X's are lit up.
And this is left to right. And if I did a right to left.
Yeah.
All right, I'm going to try that. So, so um how did I'm going try to implement that.
So, that's the size I'm going to say left to right or I'm going just call it LR and RL.
So if I iterated from left to right and then I find that uh it's greater than zero.
How do I do this?
I don't know what I'm doing yet.
something like this.
So that should give me something good. And then I'll do it again from right to left.
Just copy this and reset cur and then now when I'm is iterating through I need to count the streaks.
All right, here we go.
So, I'm racing through right now.
And I'm going to say if if left to right is one or right to left is illuminated, then we're good.
But if it's not illuminated, increment my streak.
Every time it's good, I'm going to have to add.
How do I know? So divided by three.
One / three.
How do I say that? So if it's one streak in a row, it's one light. If it's two streaks in a row, it's still three streaks, it's still one light.
So if is is it just streak divided by three?
seal.
Is it the ceiling?
I think so.
Let me see if that works. There might be a some problems with my code.
Zero. That ain't right. And one. So the one is good.
How come this? Oh, because I need one more post-processing.
So, two and one. All right, I think I'm going to submit this.
Easy. Not bad. Not bad.
What's next? Q3 finish time of tasks one. You're given an integer and representing the number of tasks in a project numbered from 0 to n minus one.
These tasks are connected as a tree rooted at task zero. This is represented by a 2D integer array. Edges of length n minus one where edges i equal uv indicates that task u is the parent of task v.
Uh you're also given an array base time of length n where baset time i represents the time to complete task i.
The finish time of each task is calculated as follows. Leaf task the finish time is base time I.
non-leaf task. The earliest be wait let earliest be the minimum finish time among its children and latest be the maximum finish time among its children.
Let own duration be latest minus earliest plus baset time I. The finish time of task I is latest plus own duration.
Return the finish time of the root task zero.
I don't know what they're asking, man.
Earliest be finish time among his children.
Latest earliest.
All right. Um, what the heck?
So, let's see. Example one. N is three.
There are the edges. Base time 953.
And they ask the finish time for the root task zero.
Uh co-coder what's happening subs. Oh what's not happening co-coder deleted message anyways.
Um what was I what was I doing?
or the root task.
Elite way, what's up? I think a lot of YouTube people think I'm not live on YouTube because I still have to update my stream to show my YouTube messages on the chat.
But I just been really lazy, man. I haven't done that yet. So, anytime somebody types a YouTube message and it doesn't show up on my screen, like how the Twitch messages show up on the screen, they think it's a recording and then like they usually leave.
So, one of these days I'll change that, man.
Um, I don't understand what this problem is asking yet, though. All right. Task two is a leaf. So its finish time is just its base time. Task one has one child. So earliest and latest is three.
Latest minus that's zero. Plus base time is five.
So the finish time of task one is eight.
All right.
One child.
Oh, I see.
all of his direct children.
I see what they're saying.
So, we need a DFS. That's what they're trying to tell me, man.
Or something.
I will try Let's make an adjacency list.
So I'm searching through all of my edges and it is directed. So zero has the children E1, but it's also weighted, right?
But the times are given here. So we're good.
Right. So that's my adjacency list.
What's next? Next is I guess I want to DFS from the root node um to somewhere. I don't know how to do it yet.
So that just return like that.
All right, let's figure out how this works. So we do some stuff.
Do we need a scene?
I don't think so.
We do some things. Um, visit all his children.
Um, earliest and latest.
But first, maybe we can be like If there's nothing in the adjacency list, then this is a leaf node.
And we can say if it's a leaf node, we should just return the base time.
So if it's the earliest, latest whatever they say own duration is latest minus earliest plus the base time.
So, it's telling me to do that.
And then here, just visit every child.
Um, All right. Is that it? I don't know.
Seems a little sus.
And I guess maybe these should be long longs.
This should probably be a long long.
This should be a long long.
All right, let's see.
17 12 18. What do we have? 17 12 18. Should I send it?
I'mma send it.
It's too easy.
Why is that so easy?
Um, Le code making Q3 easier than Q2.
Seems so.
All right. Q4. Count good integers in a range. You are given three integers L, R, and K. A number is considered good if the absolute difference between every pair of adjacent digits is at most k.
Return the number of good integers in the range L through R inclusive.
The absolute difference between values X and Y is defined as that.
Come on. Some digit DP stuff.
I don't know if I got an inmate to do a digit DP right now, man.
But let's see.
Um, absolute difference between every pair of adjacent digits is at most K.
Can I do a digit DP? It must be digit DP because look at that 10 to the 15th.
But I don't even remember how to do a digit DP right now and how to modify it to fit for this problem.
Difference between values.
So basically I just need the previous digit and the current digit. I can do it. I can do it. Let me try.
Um, I will try.
I actually don't know if I can do it, but we'll see. First thing, um, I'm not even sure what I need here in my parameters, but I do know I need the digits. So, I'll make a function And I guess we should return vector of ints.
So this is the digit mod 10 / 10.
I guess we should reverse.
I think so.
I will reverse.
All right. So, that's going to give us some digits and we're going to be like, uh, Steven Sagall, what's popping?
All right, those are my digits.
I guess we can say what what can we say?
Maybe I should actually pass in my digits.
Um, I know there's a boolean that we need fourdigit DP.
We're going to need some other things, man.
All right. So, if we go out of bounds, we're good. We're just going to return one maybe, right?
Do I care about trailing zeros or leading zeros?
I'm not too sure, but I know I have to go through all the numbers and like if it's um too much at most K. So if it's greater than K, we don't even need to try.
But there's a whole lot of things I'm missing here. I have to try and remember things.
How are you doing, Steven Sagall?
Are you still at the company you used to work for?
I don't even know. I know uh lots of things are happening over there, you know.
Anyways, I guess do we need a limit or something?
Aren't they recording your desktop at that company right now? What you talking about, man?
Hey, Fluffy, you're still around? You hear the bee, man? The bee has been buzzing the whole stream, man. I'm Oh, [ __ ] It's in my lights, man.
You guys want to see this bee?
Oh, it's right in front of me right now, man. I don't know what to do. Should I end stream? This bee's gonna get me.
Show me your B. I'mma show you right now.
Wait.
Oh, I I just took a I just took a few pictures of that bee.
Man, how did it even get in here?
Killing this can't end. Get my wife to kill it. No, we don't kill bees around here, man.
All right. Oh [ __ ] I don't know what to do, man.
All right. I posted the picture.
Jesus is my Hold up, man.
We got problems.
We got big problems here.
Jesus Christ. Here's a bee.
Look at that bee, man.
It's lost.
What is it doing?
I'm a little bit scared. It's real difficult to concentrate on a dang leak code problem trying to do digit DP when there's this bee buzzing around like he looks angry or something.
Um, my window's open because of because of AC. What does that mean? Your window is open because of AC.
Yo, it's getting closer, man. It's getting crazier.
He's too close, man.
Oh [ __ ] Yeah, he's in some funky movements, right? I think he's trying to sting my lights.
Did he just sting my light, man?
Did he just kill himself?
Uh [ __ ] I don't know what to do.
Hold on. Have you been stung by a bee before? I've never been stung by a bee in my whole life because I don't mess with them.
I don't shoe them away. I don't try and hit them or swat them. I just stay out of the way, man.
Like it can kill. Yeah, I seen that one movie when I was a kid where the little boy got stung by all the bees and he died.
Oh [ __ ] All right, guys. I might have to end stream, man.
I don't know where he went.
All right.
Oh, Jesus Christ.
Hey, did you guys see it? It flew like right on my chair. I don't know if you guys saw it, man.
My girl. Yeah, I think that was the movie where the kid got stung by the bees.
All right.
Oh [ __ ] It's in my top light, man.
Can't believe you're scared of a bee.
What do you mean you can't believe that, man?
I'm not trying to get stung.
It sounds angry, man.
I don't want to kill it, but I might have to because what am I going to do? It's got separated from its colony.
is probably going to die in here anyways.
Might as well just kill his ass.
But then he's going to sting me if I try and attack it, man.
All right. It's been chill so far.
Uh let me just focus on the DP.
Looks like a work. Oh [ __ ] man.
Hey, Q. Ultimus, thank you very much.
Thank you very much for the sub, man.
There's a bee and he's he's buzzing around right now and I'm a little bit scared.
Oh Jesus.
He's getting more and more crazy as time goes on, man.
Um, I don't know if I can focus on digit DP.
And there's this crazy man. I got to take a video of this thing. He's doing some crazy moves, man.
I think he's freaking out.
What the hell are you doing, Mr. B?
It's not a good video. He stopped.
My heart rate is Let me look at my heart rate right now. It feels like it's bumping.
Oh [ __ ] My heart rate is over 100 beats per minute right now.
Usually it's not. So this bee is crazy.
All right.
Wait. Um, let me do this before I forget. Man, Q Ultimus, thank you very much.
Also, what's up, Q?
Hey, I think the bee killed himself.
He's not moving anymore, man.
Like completely stopped moving.
I think he exhausted himself, man.
Think I should try and capture his ass and put him outside.
You think he's playing dead?
Wait, man. I wish I had a webcam on his ass.
All right, look.
Look at him.
I send you.
Look at him. He's not even moving. He's curled up in a ball. I think he exhausted himself.
All right, I got my eye on him, man.
Does he have a big back end on him?
Sussy. Wait, maybe. Yeah, he was looking like he was moving a little strange.
Maybe he stung my light.
But all right, if he's playing dead, he's real good because I've never seen a bee play possum like this before.
Anyways, we got to focus on this problem, man.
the bee might be dead now. He just killed himself.
Um, all right.
It's a bug farm. What you talking about?
That thing is huge. I could hear him buzzing from across the whole room. Man, I I didn't scare him to death, man. He scared me to death.
I am not from Texas. That bee looks harmless right now. It looks harmless, man.
Oh, man.
All right.
You have to leave the chunk for a bit so it despawns. What are you talking about?
I can't I've never seen an animal die so quickly.
Is it dead?
It's still not move. If it hasn't moved this long, I think it just exhausted itself to death cuz it was starting to freak out, man.
It was starting to like do all types of crazy moves. It was flying, going upside down, twisting its body.
Maybe it was poisoned.
Who poisoned it? Not me. I don't even know how it got in here, man. How the hell did a bee find its way into my basement.
Anyways, um did it try to sting the light? Do you think it ruptured his inside like on the net geo documentaries? Hey, that's what I'm trying to wonder. But I I can try and get a closer picture.
My blood. Hey, bees don't drink blood, man. That's mosquitoes.
What you talking about? My blood is crazy. The bee didn't even sting me.
Um, yeah. This This bee This bee is not moving. I think we're safe.
I can't even focus on it.
All right. Um, I'm going just leave it. Pretend it's it's dead.
What a stream though. We saw a new life introduced to us. saying it was taken within minutes. Yeah, I'm surprised it died like that, man.
Pick it up and give it a proper burial.
I'm not touching that thing.
Uh, Tanvir Singh, what's happening from YouTube? How are you doing? I'm sorry, I'm a little bit distracted right now, man. And a bee just came and invaded my space. And we think he's dead, but he might be trying to trick me.
The be is being courteous. Have they heard you were in the middle of a contest? Yeah, I should have waited.
Anyways, [ __ ] Don't you have hawk wasps or scorpions in Jamaica?
I haven't seen a scorpion. I don't know what a hawk wasp is.
But yeah, there is there's flying things in Jamaica for sure.
I'm scared of them just like how I'm scared of bees though. I don't mess with things like that, man.
Honka, Frosty Bagel 2, where am I from?
I'm from Jamaica, but right now I live in Canada.
Anyways, that be messed us up, man.
Uh, tarantula wasp, man.
Jesus Christ. I've never seen one of those things in my life, man.
I've never seen any dinosaur mosquito like this. That's crazy.
No, he's smart enough to play dead.
Wait, he could be an old man that wandered off and he exhausted. Yeah, I think he just exhausted himself to death. I've never seen anything quite like it. That's the first time I I saw something die right before my eyes from exhaustion.
What if that bee was actually you reincarnated?
How is that going to be me? I'm not dead yet, man.
All right, we got to get this one problem done.
Um, how do you how do you do digit DP? So, it's like let me try and remind myself. So if I had some number 452, I call the first thing.
The limit would be four.
um is equal would be false and then scene on zero.
Maybe we also need that.
I would take a bee over a wasp, hornet, or mosquito any day. I would take nothing over any insects in my basement any day. Man, I'm not too scared of a bee because I know like they don't really attack you unless you bother them.
I wasn't worried in the beginning, but as that bee got more crazy as time went on, I started to get scared cuz he was starting to fly all types of craziness.
I thought he was going nuts and it's best if I stayed away.
You have to pick one. I'll pick I'll pick a single mosquito because I can kill those things easily and if they bite me, it doesn't really hurt.
You looking uh to get into quant trading aftershock. What's happening? I'm not looking to get into quants.
Malaria, man. I' You know how many mosquitoes bit me? I haven't gotten malaria yet. Think I'll take my chances with a single mosquito.
How much runway you have left? Probably I have more runway left than I had when I started my journey or started using my runway.
which is crazy. I don't even know how that's possible, man.
Yeah. How? I don't know, man. I don't know how that happened, but I guess everything just goes up.
How's the non vacation queue? It was good. I think it was necessary to disconnect for a little bit.
H.
Um, anyways, but regardless of how much runway I got, I'm still capping it at around two years. So, right now, I'd say we're about 6 months in that 2year time period.
So, I got like a year and a half before I got to make another decision, whether to keep going or to get a job.
But I'd say it really just began, man.
Because the last six months or so, I don't think I really starting anything. I think it's more of just like an adjustment period for me and a little time to cool off. But now I feel well rested and I'm ready to actually start uh the real battle, you know.
trying to do content creation full-time.
No, I don't think I want to be a content creator like that, man. While I do enjoy streaming and stuff, I can't imagine if like all my money is tied to trying to go viral all the time or something, man.
I'm not I'm not uh I don't want to be an entertainer, I think. But I do enjoy streaming and talking to people sometimes in Roses.
What's happening? Assuming job, where would it be?
I'm not sure. Wherever is bumping at the time, wherever would hire me? Maybe if my old or took me back, perhaps I would go back there or at least start there. Um, but that's in like two years time. So, a lot could change in two years, especially how the last year went. You know, that bee was your best content and it died, man. You think that B was my best content?
My content must suck.
That's why I'm not a content creator.
All right. Um, I'm a little sad that the bee died right in front of my eyes.
Like, I just There's only been a handful of times where I seen something just die right before my eyes, man.
And I'm feeling pretty sad right now.
Like that mouse. Yeah, like that that mouse. One time I was walking to Costco in New York with my wife and we saw a mouse on the side of the road or a rat. I think it was a mouse and then somebody on a scooter just hit the mouse and I just watched it die right in front of me, man.
Um, how are you feeling sound about the bean now? I gave you an ex existential crisis two minutes ago. What do you mean?
Um, I don't know. I guess we'll see.
So, potentially you would move again.
No, I don't want to move again. All right. If I had to go find a job, it would be somewhere where I live now. But I know like my old org had people in Toronto, people in Zurich, people in New York, people in Seattle, and people in Sunnyvale. So I think if I were to go back to a job and they could get me in that Toronto office, maybe I'll just go there.
Be will go down in history as one of the legendary characters of this stream along with pixel pusher and Cornelius.
Man, maybe life is so ephemeral. We're We are that bee. We are that bee, man. That's why I'm a little sad.
Wait, how are you feeling sad? I see.
Um, man, it's still a bee, man. I could see that the bee was in distress. like I heard the bee, I didn't trouble it. I tried to just go about my business, but then he started to come closer and closer to me and I've never really seen a bee like be attracted to the lights, but he started to go towards my lights, man. Maybe he's like flying to the gates. the the light, you know, the white light is coming and he just wanted to go there and then he just stopped. He just stopped moving. I thought he was playing dead, trying to trick me or something. And then and that's it. He just stopped moving and now I'm looking at the dead body.
What if it was asking asking me for help?
Um, yeah, it was kind of crazy how the chat started buzzing when that B came along. Yeah, I guess people rather watch me get scared of a bee then watch me do lead codes.
Probably just got stuck indoors and was looking for a way out. Yeah, K little Pixel, what's happening? This was an odd time to hop in here. No, this was a great time, man.
Uh, a bee derailed the stream kind of.
Hey, what if the bee just got up right now?
Oh my god, it's moving.
I swear I saw its body like pulsing.
I saw his body pulsing, man. He's alive.
Oh, Jesus.
But I think he's done for. Maybe he's just like having a seizure or something, man.
All right, I'm going to assume he's pretty much dead.
Are we really talking about a real bee?
Yeah, man. A bee is right here.
Put a cup on him. He's on my light, man.
I got to touch him to like get him off.
Um, anyways, when I jump out of the chair, it gives you anxiety. No, I'm just No, I'm not jumping out. I'm just trying to get a closer look.
All right, I'm about to solve this dang digit DP problem.
Um, bees can literally become zombies. I'm not lying. Hey, how is this a zombie bee?
You know that fungus? Hey, I think I watched that documentary, man.
I think I watch I watched that documentary with some mushroom funguses and they turn the ants into zombies or something like that.
What was it called?
Fantastic fungi or fungi or something.
Digit DP. One of the few DPS I never solve. AQ. Digit DP is a lot scarier than it sounds.
It's not. Yeah, it's not that bad. Q. I promise. I'm scared of a lot of advanced algorithms, but I don't think Digit DP is labeled like kind of advanced.
Wait, it's a it's not as scary as it sounds, man.
Oh, that V got me tripping, man.
Anyways, anyways, um Oh, we have to go to the limit here.
But then how do we know what the limit is the new limit?
Um, wait.
Cordicps fungus is what you guys are talking about from last. No, this this ain't no movie cue. I'm talking about real life.
Real life, not some fictional fungus.
Anyways, how do you do this? So if x is not equal to limit Oh, there's two. No.
So is equal. How do you know if it's equal or not?
Imagine that fungus can control us one day. Hey, one day it might happen. Sue such chut what's happening I can't say the name properly such cut I can't read how you doing um wait the idea for the game came from real life the real life name was ofio cordicps unilateral What?
I didn't know that. In England, our bee population is so bad and declining that we have important bees from the Netherlands and Norway.
Important or imported bees.
I mean, England is a good place for Simon. No, I don't think so. I mean, maybe I wouldn't mind. Um, such cut. What do I do?
I'm pretty much a bum. I don't do anything. I don't have a job. I just stream sometimes and I do leak codes every now and then.
Bees are dying. Can't believe Simon I didn't kill that bee, man.
I didn't kill that bee.
All right, let me try and solve this problem because I got to go soon.
So, the new is equal. So, if we were equal, how do I know, man, what the new equal is and scene non zero.
All right, let's try that.
DP uh digits I + 1 the new limits new equal and new zero and then what are we trying to do? We're trying to add those all up and then we have to mod something or no.
Do we add them up back here?
And then so our digits um limits I guess false.
No, no, no, man. Hold on. Hold on.
What's What is my limit here?
Is it equal initially?
Should I say false?
True.
See non zero. False.
All right, let me try that. Man, I didn't even catch it, but let me see if it's correct first.
No, you want us to believe it. Randomly died. Yeah, we have saltfish and aki and no bees. Yeah.
How Hey, do you know how much aki costs in England?
I'm guessing you have like tin aki or something. In Canada, it's like $14 a can. Man, it's crazy.
All right. What is it saying?
Oh, and this one.
One 14. No, this ain't good.
All right, I got to try and figure out what's going on here.
I got 19 minutes before the time is up for this contest.
So, I get three H And then nine.
Interesting.
How much grams in the can? I don't know, man. I don't know that off the top of my head.
Two.
That's crazy.
That's crazy that L digits at nine is two.
Um, so I think there's a bug for sure. I mean, obviously there's a bug because it's not right.
Then we put some either seyous or hey this should be a lot more. So it's coming in got the digits.
It's adding up the rats but it only gets here one time.
So initially, oh wait, this is I and my limit. So my limit in this case should been whatever. Let me do some see outs here.
I say it's about4 to5 for a can, which is about 9 Canadian bucks. Interesting.
That's decent price, I guess. I guess there is probably a lot more Jamaicans in London or I don't know. I don't know if there's more in London than in Toronto, man.
It's tough. There's a lot of Jamaicans in Toronto.
All right. There's a lot of Jamaicans in New York, South Florida, Toronto, and London. Those are like the three hot four hot spots, but I don't know which one has the most.
If I had to guess, maybe New York also have lots of bayons.
Bahamians, that's what you call them.
Trinies also. Yeah.
You're in I am in Toronto. I see black deep. What's happening? I'm near Toronto.
Millionaire. Who's a millionaire?
Wait.
Who's Who's a millionaire?
Oh, Barbados. I see. I don't know any Barbians.
All right. So, this digit is nine.
Um.
Oh, I see.
I see where I'm messing up.
Is that Jamaican meme? You don't know it? No. Millionaire.
Jamaican meme. You guys looking at Jamaican memes?
Are you a Stanley girl? What does that mean?
Anyways, I think I see the um this is wrong right here. digits I.
So it should be if I greater than zero and digits I -1 is greater than K continue.
All right, let me see how that looks.
We'll see.
Negative 10.
No, I think I messed this part up.
Um, I I see what I'm doing, man. And I'm seeing like bits of it, but it's a little distracting le to try and like keep up with chat and focus on the bugs in my code. But I see what's happening because the nonzeros something with the nonzeros here. This part is wrong for sure because that singledigit one is getting all of them and then the twodigit one is not getting any of like single digits.
So it should be like maybe instead of doing the I minus one thing I should there's a different way I can do it but I don't know.
Lewell says I need to lock in.
Wait Birmingham and Manchester also have massive Jamaican populations. I would say half the British national football team is of Jamaican heritage. Yeah.
Now, I know there's a whole lot of Jamaicans out there, but I think they're mostly older Jamaicans from way back when uh Jamaica was a British colony. I don't think the new wave of Jamaicans aren't going to England like that, man. They're going to like New York or South Florida or Canada.
All right.
So, so if we've seen a nonzero maybe, but we still have the cash things, but we're still just trying to find a correct answer.
Um, do you have one tip for succeeding in Java algorithms at university?
I'd say the one tip I have is study hard. Uh, I don't think there's any secret code or anything.
Uh it's just about how much time you put in and how hard you study. So that's that's my one tip. Create a schedule and stick to your schedule for studying, you know.
Wait.
Uh wait, no, they're the ones from the Wind Rush generation. You're you're right. Very old wind rush generation. Never heard that term.
I was happy to see how fast I was solving this leak code contest, but then the bee ruined it. Yeah, I like the way you think and explain things so calmly.
When something doesn't work for me, I get frustrated right away and then nothing works anymore.
Um, sometimes I get frustrated too. Like right now it's hard to focus because that B kind of threw me off.
But I think that's also built up over time.
It's not like I was born and I was like how you see me. It took a lot of practice and stuff to get here, you know? So don't get frustrated um if you don't have that level of resilience yet. So you do more, you get more resilient, I think.
Question marks.
What happened?
All right. So I think I have to figure out my leading zeros thing and then um the previous digit. So, it's getting a little strange because if we seen a nonzero.
So, if this is false, that stuff shouldn't trigger.
But this part So I'm trying to do it without introducing another number here and I think we can.
So, I just need to make sure that we seen a nonzero.
And I guess if we've seen a nonzero, then we can remove that.
But that's like the same thing.
And then this one besides 10 It would have 11 wait 10 11 and 12.
So this should be nine. I should get the first things would be nine and I should be getting 10 11 and 12.
Uh I got to do some see outs here. I got to see my L digits. No, my R digits should be returning 9 10 11 12 numbers, but we're only getting 10.
Why is that?
We're only getting 10.
So if R was 10, how do we get 12 if R is 10? Isn't that a little crazy?
Wait, any reason for not introducing another ARG? Uh, not really. I just feel maybe we can do it without the new AR guys going to introduce is previous digit. Previous yeah previous digit but I feel like we don't need that.
Oh wait, we do need that man. Why am I tripping?
Because it's not what's in digits i minus one. That's going to be fixed.
That's never going to change. So, we do need um Yeah, I don't know. I'm too distracted to think straight. That's the problem. Le oil 1947 sounds way too late for the first Jamaicans. Wait. Named after Wait, the Wind Rush. Named after the boats Empire Wind Rush, which brought over the first Jamaicans to the UK in 1947.
Sounds Yeah, it sounds a bit late, but maybe it was like a boat with only Jamaicans or something because I know some Jamaicans. I guess Jamaica wasn't a country yet, but it was an island and I think they helped in World War II, but it must be like some other arrangement there.
Anyways, all right, five five minutes left. So, let me introduce this new thing. I'm going say previous digit.
I'll just call it pre and instead of doing uh this thing it should be x minus pre and pre becomes x and then um initially I guess we can it doesn't really matter I'll put negative big number.
Looking at Wikipedia, looks like a postwar wave of migration.
Interesting.
I don't really know that type of history, but maybe I should. You know, I like Jamaican history.
All right. Two. That's not right. 66.
All right. We still got some more problems, man.
Oh, wait. Let me take that out.
Two and zero. All right. We definitely got more problems.
Um, all right. How can I debug, man?
How can we debug this scene?
All right. So, this should return 12.
But turning 78, that's how you know something ain't right, man.
Look at that wrong test case. Oh, wait.
Oh, yeah.
You're right.
Um H.
So, it's returning 12.
Um maybe it's a problem with K being greater than one.
at most.
Okay.
Where am I messing up?
C non zero is false.
The limit. Oh, wait.
Go to the limits. Is that right?
Go to whatever they tell us to to go to.
Suss pass limit along like this. Right.
Right. I was just thinking that because usually you calculate the limit whether or not we're equal.
It's been a while, man. Wait.
Um, let me think.
Do you have a degree? I have a degree in mechanical engineering, but I got really long time ago back in 2010 or so.
16 years ago. Dang.
I was never a mechanical engineer.
So you're saying we don't need to pass that limit.
We just need to pass is equal.
Time's up. But I'm still gonna try, you know, a little bit cuz I got to go soon.
Um 13. Is that right?
I've heard too many Emmy stories for me to believe that. What are you talking about, man?
Oh, look. This is right now. It's crazy.
Now I need to cash it.
That I was never an I was I never had a mechanical engineering job, man. No one wanted to hire me because I don't know why.
Um, man, one, two, three, four dimensions.
Two, three, four.
And it's a long, long.
All right. First one.
Oh man.
Um, can we use the same cache?
So, one is equal boolean.
Wait, how do you do this? Vector vector I always forget the easy way to make crazy dimensions.
Vector, vector, vector, long, long, one, two, three.
It's going to be two and then vector vector long long and it's going to be two vector long long.
And this one is going to be 10.
Set that to negative one.
Um, YouTube, what's popping? Good morning, Abilash. How you doing? You from Canada?
How's life there? I live in Canada.
It's pretty cool. It's kind of bad right now because there's a lot of wildfires going on. So, the air is real funky.
Um, accounts office officer, what's happening? I'm from India. Welcome. Welcome.
Brent said CS is the new me.
Yeah, maybe internship though or Yeah, I've had an internship and I had a senior project and stuff.
Um, I interned with Loheed Martin for my some alter not like weapons or anything.
I did the Loheed Martin alternative energy division that got shut down and I never got a return offer because the whole department got shut down they say.
Um, hold on. I got to go soon. So, I'm just trying to finish this.
Come on, man.
What are they talking about here?
R digits.
What's Oh, maybe maybe when the previous goes in.
H I want to leave zero as previous. Then show chat the photos I sent you.
What photos?
Yo, what the heck kind of photos are you sending me, man?
What the [ __ ] Where did he get his picture from, man?
Yo, I didn't kill no dang bee.
Hey, is that the same bee?
He moved, man. He doesn't He's not in that position anymore.
AI slop.
Anyways, I'm so sorry for that bee.
Ew.
All right. Something ain't right.
Something ain't right.
All right. I got an idea. This previous needs to be something else.
And then I'm going to pad it um to 11.
And then I'm going to give a plus one to the previous in there to see if that helps.
But they don't like that either, man.
Oh, I'm going to need separate caches.
Dang. And that's what I was trying to wonder, too. Do I can I use the same cash?
All right.
All right. We We got this. We just got to make big ass cash. Um, hey, can I can I just say auto cash?
because I'm not trying to type all that again. But I I kind of see how the cache might mess things up, especially if L and R are different sizes.
I can see that for sure. So now I'll pass in the RC cache and the Lcash.
Come on, man. We're trying to go. It's past my stream time right now.
All right. What are they really talking about this time, man?
Because is it because I plus one it and we don't need that plus one anymore.
All right.
It's too easy. All right. That was my first digit DP in a few months.
I think I got it. I just was a little bit rusty in the implementation. Um but this brings back everything to me.
AK AK this contest kind of you have killed this in a real contest.
Hey Ricky Wong, what's popping? The bee died for this. Yeah, the bee did die, man.
Um, dang, that bee though. I think it's dead for real. It hasn't moved again.
Anyways, that be is gone.
Um, all right, guys. I guess that's it.
That's all.
I'll see you guys another time.
Well, when am I streaming? I guess I don't know if I'm going to stream besides Monday, Wednesdays, and Saturdays. I haven't even updated my website. Maybe I'll work on um maybe tomorrow I'll do some work on midnights.com, like get my stream schedule back up, answer these dang questions that I don't have anywhere to answer, things like that.
You had a really good pace for this contest until the beat interrupted.
Yeah, I think I was doing all right, man. But let's see what my uh let's see what I would have gotten with only three solves. Dang, with only three solved, 3600. That's decent.
And then I I think I would have gotten that Q4 in a real contest. Um, but basically everybody wait what it say 3 I came 32.
Hold on. I got to look at that one more time.
36. So I'm almost the fastest person who never solved all four in this contest.
because 3,200 is like the fastest Q3 solver.
So that's decent.
Very good for me actually.
All right, man. Thank you very much. Oh, Muhammad, what's happening? Hi, I'm graphic designer and start learning AI inspire from your programming skills.
Thank you very much, man. Um, I've been programming for a long time.
I've been programming since 2013.
No, wait.
Yeah, 20 13 years I've been programming, man.
But every year I haven't given it good effort. Some years a whole lot of effort, some other years almost nothing.
I was 13 and 13. Dang.
Um, yeah. RIP B.
I was I don't know how it was in 2013, like 25 or something.
This year, two months on vacation. Hey, that's normal, man.
That's I used to I used to live my life on vacation every year and that was a those two months it was a good reminder of what my life used to be like before I became a corporate drone.
Uh you got to show your family Japan.
Yeah, it was nice. Yeah. Rest in peace, Mr. B.
Um, Abilash, have a good night. All right, let me say my goodbyes to everybody, man.
And then, um, how do I how do I do it again?
All right, everybody. I'm out of here.
Today's my first full threeh hour stream since I've been back and it's nice.
Anyways, I gotta go, but I'll be back on Saturday to do more le code and sprites off rager. What's happening?
Or spirits off. Sorry, I can't read.
See you later, man. Le Whale Addios Q Ultimus take care. Uh, Abilash from YouTube, Muhammad from YouTube, accounts officer Mr. M from YouTube. Have a good night. Thank you very much for tuning in. Icy Black Deep, Steven Sagall. Halo halo. We them boys. Adios. The engineer Ricky Wong. Have a good night. Thank you very much for watching me le code and uh run away from the bee.
Um, Shalev, have a good night everybody who's lurking. See you next time. Wait, I didn't even initiate a raid, man.
I don't even know what I'm doing.
I'm supposed to initiate the raid and then say my goodbyes.
Jesus. Now I got to Who Who am I going to raid real quick?
Now it's awkward. Yeah.
Um, I don't know who to raid, man. You guys want to watch somebody play video games?
I don't see any leak coders on right now.
Raid Ninja. All right, I gotta go. I gotta go. Um, I might not even raid, man.
Next time I'll raid somebody. Today, I don't feel like raiding nobody, man. So, I'll see you guys. See you later YouTube and everybody.
Related Videos

TOP 15 Data compression Interview Questions and Answers 2019 Part-2 | Data compression | Wisdom jobs
wisdomjobs
281 views•2019-06-28

CTS 158: 802.11w Management Frame Protection
ClearToSend
4K views•2019-02-04

NDSS 2019 Send Hardest Problems My Way: Probabilistic Path Prioritization for Hybrid Fuzzing
NDSSSymposium
496 views•2019-04-02

How realistic is Cities: Skylines?
CityBeautiful
159K views•2019-02-14

GUIs & TUIs: Choosing a User Interface for Your Python Project | Real Python Podcast
realpython
2K views•2025-04-04

The OSI Model - Explained by Example
hnasr
225K views•2019-05-12

Cloud Computing - Introduction
elithecomputerguy
98K views•2019-10-07

From Traveler's Dilemma to Dynamic Routing | Demystifying Networking
IITBombayJuly
5K views•2019-08-04
Trending

WOW! Judge TURNS THE TABLES on Trump in His OWN $10B LAWSUIT!!!
MeidasTouch
197K views•2026-07-23

Playstation NO DISC/NO BUY Fight Is Over...
DavidJaffeGames
4K views•2026-07-23

Steam and Xbox Just Dropped The Hammer On PlayStation
OhNoItsAlexx
9K views•2026-07-23

Americans Confused in Australia for 17 Minutes Straight
IWrocker
17K views•2026-07-23