Given a binary string where 1 represents an active section and 0 represents an inactive section, you can perform at most one trade to maximize the number of active sections. A trade consists of two operations: first, convert a contiguous block of ones surrounded by zeros to all zeros, then convert a contiguous block of zeros surrounded by ones to all ones. The optimal strategy involves treating the string as augmented with ones at both ends, then finding the longest streak of zeros that contains exactly one group of ones inside it. The maximum number of active sections equals the original count of ones plus the length of this longest zero streak minus the length of the smallest group of ones within it, minus 2 (to account for the augmented boundary ones).
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
LeetCode Practice - Daily problem & Virtual Contest
Added:Microphone check. One, two.
All right, I'm live, man.
Here we go.
Wall-ally villa 24. What's happening?
All right. Am I ready now?
Oh.
All right. Let's see what they got for us today, man.
Um, maximize active section with trade. Part one. You're given a binary string s of length n where one represents an active section, zero represents an inactive section.
You can perform at most one trade to maximize the number of active sections in S. In a trade, you convert a contiguous blocks of ones that is surrounded by zeros to all zeros.
Afterward, convert a contiguous blocks of zeros that is surrounded by ones to all ones.
return the maximum number of active sections in S after making the optimal trade.
Um, no. Treat S as if it is augmented with a one at both ends, transforming T into 1 + S + one. The augmented ones do not contribute to the final count.
Um, uh, Becca, what's happening? And Perito 95 RSNG, welcome to the party. Bang.
30day stream streak.
Very nice.
What is this? What is what this problem?
Um, yeah. What is this problem?
So, they're saying pretty much ones inside of zeros inside of ones.
But you can only do one trade.
So wait, convert a contiguous blocks of ones that is surrounded by zeros to all zeros and then convert a contiguous blocks of zeros.
So I don't think these can these don't have to be the same thing. It can be.
So, it's one trade is really like two trades, but I guess it's a trade because they're giving up ones for zeros and zeros for ones.
Um, and they want to know the maximum number of active sections after making the optimal trade.
So we're trying to maximize active or sections.
So in this case you can't do anything in this one. I guess this is surrounded.
I guess you turn that one to a one.
You turn that that one to ones. And then everything can be are they just they're just asking um you want the biggest zero streak and you want the biggest one streak that doesn't touch the edges. Right?
That's what I'm thinking at least.
um 10 to the 5th.
Let's look at more examples. So, example two, we can turn all of them into ones.
Example three again it says well this one is seven. So I would assume so we turn zeros to ones and ones to zeros.
Wait, what?
You choose.
All right. So, they're choosing this.
What are you What are they going to do with that?
Um, you can add one. No, I think this they're saying that the ones are at the end. So, you can assume the string beginning and string end has ones at the boundaries. At least that's what I think they're saying.
But how what are they doing here?
converts this.
Um, oh, I see. They convert that one to a zero and then convert I see. I see what they're saying. They turn this one to a zero and then they turn that big block into all ones.
Huh.
Interesting.
Seems tough.
Um, so this one they say it's four.
Let me see if I can figure out something here.
So maybe for four, yeah, I guess you'd transform this into a one and then either of these ends can be transformed into a one.
All right, what am I thinking?
I'm thinking maybe it might be a good decision to keep track of the longest streaks of ones or the the smallest streak of ones and the longest streak of zeros.
Um, but example three makes me think that maybe that's not all we need because I guess ultimately this streak of zeros maybe it's asking the longest streak of zeros with one streak of ones inside of it. I don't know how to say that, man.
You can only skip the ones once one time only.
Um, but then you have to find all right this problem does seem difficult. I wonder if let me try and switch up my thought process a little bit because nothing is screaming at me like this must be the answer. Let me think.
Can we binary search on the answer? Can we guess that four is possible or three is possible here?
How do you validate that a particular answer is right?
I guess we can validate that uh one is okay because there's at least one section already. How can we tell that two is okay?
Um, I don't know. I don't know if binary searching on the answer is what I'm looking for here.
Is it just some weird sliding window, man?
I am not sure. Um, but if I were to try anything, I think I'm going to lead towards some type of sliding window.
So maybe I should actually append the ones or put the ones at the ends and then solve for that and then minus two from the answer.
All right, let's try with this. Let me start trying to figure it out with asky characters like trying to draw something. All right, these are my ones that I just put at the ends.
So, the answer should be one, two, three, four, five, six, seven. We can turn the whole string into ones.
Um, and I'm looking for either the longest group of zeros uh where we can skip one batch of ones.
I think I can do a sliding window to detect that.
But what if there what if like there's no groups of ones within the zeros? Like what if it's something like this? Then there's like no groups of ones, but we'll still see these ones.
I don't know, man.
Guess we can slide a window and 10 to the 5th.
Can I think of anything else?
Sir Lord good, what's popping? How you doing?
Oh, this problem is hard for me, man.
And low acceptance rate, too.
Turn that into a one.
I guess this is where all the cool vids hang out on Monday nights.
What are you talking about? Monday nights. Cool vids. What?
I'm stumped on this problem. Rexos, what's happening, man?
Oh, cool kids. I like what what videos hanging out here, man.
Hey, Rexo. Is this problem tough or am I tripping?
It's only one trade, man. It's at most one trade.
So, I'm trading a bunch of zeros for a bunch of ones.
If I can convert It should be easy, man. You're tripping.
Oh, ICPC world finalists says it should be easy for me.
All right, I'm just going to say because I'm out of practice.
converts ones to zeros and then zeros to icy black deep. What's happening? That's my excuse for everything at least uh recently because I am rusty man. I don't even code anymore except leak code. Try to analyze this way. What if the sequence looks like one 0 1 0 1? Yes, like example four. All right, let's see.
What if it looks like something like this then?
Then let me try and see what's going on here. We take a group of ones, turn it to zeros, and then a group of zeros and turn it to ones.
What does that tell me?
I don't know, man.
I can't see anything except for a bunch of ones with one group of zeros.
Like a streak of zeros with All right, maybe it's a streak of zeros with one group of ones in it or Or it's the longest streak of zeros minus the smallest streak of ones or something like that.
Like if there's no groups of zeros.
No, I don't know.
All right. I don't know if that uh sequence he gave me did anything for me, Rex. So, or at least I'm not I'm not seeing anything.
All right. Should I try that though?
Should I try um the longest group of zeros with containing like only one group of ones inside of it?
Wait, what is optimal in this sequence?
Uh I guess it would be wait let me preserve the original.
It would be something like five six six I think. Why would it Why would it be something else?
No, the two extremes don't count.
Oh, so you're saying all right, so you're saying those extremes are actually not a part of the problem. So something like this then you transform one group of ones into zeros. I' still I'd still do the same thing and then I'd transform those. So the answer before So, let me do that one more time. So, I transform the one to a zero and then I hit uh this row of three right here.
So, are you saying I'm like counting for each group of zeros?
I count the group of ones to the left and the right and it's either that answer or or uh the longest group of zeros minus the shortest group of ones because all right I'm thinking of a case where it's Heck something like this then I guess this group H I guess it's just for every group of zeros look left and look right and add those together of the ones. I'm going to try that. I don't know if that is right, but it feels right.
So, all right. Maybe Rexo, thank you for guiding me to the answer there without telling me uh too much except just saying right and yes.
All right, here we go. Let's try and do that, man.
Um, Mr. Love Pickle, what's happening?
Any bee updates, man?
No bee updates? My wife said she found a bee upstairs, though. So, I wonder if they're like finding a way inside the house. We did a little bit of research and it says sometimes the scout bees when they're looking for a new nest, they'll like go everywhere and they'll uh like try to find a good spot and report back to the colony.
Uh so maybe the one the bees that made it into my house were scout bees, but they never made it back to their colony to tell them this is a good spot, so maybe they won't come here, move in, you know.
Wait, that is transform each maximum block of the same value to something like value length. So you can reduce any sequence to 101.
Right. I I hear what you're saying.
Um, I suppose I was going to do something similar where I guess it's it's like you're compressing uh what's that compression, whatever they call in those problems.
There's some name for it. Um, it's some dumb name where it's like five A's in a row and it's A5 or something like that.
Spnat logic, what's happening? Hey Claude, how are you? I have some bees here. What's going on? Yeah, basically that's how it went, man.
Um, all right. So, we're going to try that. What Rexo is saying. So, we got to um I guess we can either use like a pair a vector of pairs to represent those things. And then it will have whatever in it.
Um, I'll just call this compressed.
So, how we going to do it, man?
First, I guess we got to compress that thing.
So, ah, but should I put should I put the um ends? So, it's going to be one and one.
So, it's going to be char and counts or streak.
So one and one and then after some junk one and one again.
All right. So if the previous is the same wait what am I saying? If the previous is the same as the current then we increment the streak.
Otherwise, we are going to reset the streak and then reset the previous to the current.
But we got to do something else, too.
So, I guess every time the streak breaks, not only do we reset, but we also have to push into the compressed um SI. Wait, how do I tell what the current character is?
And it's the previous character. So, I guess I'll push in the previous.
Hold on. Let me think here.
Maybe I should just say the previous is S0.
Hold on. I got to think about this, man.
This might be wrong. Uh, Steven Sagetball, what's happening? How do you know if you're a lesbian or not? That sounds like a good question to ask Claude or chat GPT.
I don't know, man.
Um, but I've asked my uh lesbian friend that when we were younger asked, "Man, how did you know?" Or like when? And she told me.
She knew it from like a really young age. She was just She just knew it, man.
I don't know.
from like 10 years old or nine years old, she knew.
But that's my only experience with answering that question.
Um, how hilarious is it that you had an answer?
I'm just saying because I've asked my friend that one time. I was like, "How do you know?" You know, or how old were you? or like you know.
Anyways, um so I'm not Let me think about this how it's going to work.
I think I should not push this stuff back.
I think instead I should pretend.
Dang.
Push back a one and then pretend the previous was a one and then same as streak is one. Yes.
Indigo girls. What's that? Is that a show? Wait, you really like watching Ellen?
What? What are you talking about, man?
Ellen, um, we push the one. All right, I think this is going to work. If it's the same, we increment the streak. Otherwise, we push back the streak and then we reset the streak.
And then we got to push back the last character.
Um, man, but what if the last character No, we we already we already did that part. So we do we do have to push back the previous character and previous streak.
Ellen Degenerous.
She still has a show. I don't even know anything about her, man. Do you see Obsession? I want to find me a girl like that. I did not see Obsession.
Ellen is such a USA thing.
She was a thing like 15 years ago or something, man. I don't think she's a thing today. Is she? Who knows? Anyways, now my compressed junk should be all right.
Ah, but there might be more to it, huh?
Maybe I should remember max zero and minimum ones.
I don't think she's been relevant for 20 years. That's what I thought. I see black deep.
Wait, the final episode of the Ellen Degenerous show aired on May 26, 2022.
Dang.
Um, that was only a few years ago.
I didn't know that.
I've never really watched their show, so not sure.
Um, all right. Hey, David Huffman from YouTube. What's popping? Welcome to the party. We're trying to do the daily problem, and it is a bit challenging for me.
All right. So, now these are the 0101's.
Oh, I see what Rexa was saying now.
Um, so we've reduced pretty much the whole thing to this alternating sequence of streaks.
Then the best streak would just be wait what was the answer again?
The uh the zeros plus the ones in the the one streak.
Uh h I don't remember what I was saying. I swear I saw the vision and then now it's gone.
So it's like a zero plus or a one streak. So it's either All right.
It's either a one streak plus the outer zeros or it's this it's this thing I'm trying to do, right?
The max zeros and minimum ones.
All right. Um, I lost my train of thought with this problem a little bit, but let me let me see if we can solve it. Um, and I guess also these need to be integers and not asy symbols or whatever.
Man, sometimes my brain feels like it doesn't work. Wait, it doesn't matter. What you talking about, Rexo?
This part doesn't matter. Only Wait, every ASI is an integer. Oh, yeah.
Yeah, yeah.
Um, every ASI is an integer, but you know what I'm saying, man. I don't want it to be a char when I'm comparing chars. Anyways, I'm trying to say I'm trying to say I'm trying to look for a one and the outer zeros.
No, I'm I think I'm I'm confusing myself right now, man.
Because All right. What the heck, man?
Let me let me do this exercise one more time. So, you say what is the answer here? And the answer I said is you turn this to a zero and you turn this block into ones.
Yes, that is the answer. So, it's I'm looking for the one followed by the zeros. But what if what if it's this one? What if it's an end ones?
Then does it matter? Let me see. What if it was like one one 01? So this this whole thing would be a five streak.
Yeah, I guess it still works, huh?
I'm just going to go for it, man. I'm tired of trying to think it through.
Um, wait.
All right, I'm rusty. Bear with me.
All right, I recommend using indices since you'll need the previous and next. Yeah. Yeah, I just realized that as I was typing the for loop, man. I was like I Hold up. I might need to peek back and forth.
So, how do you do this? Character streak compressed eye. Right. So, now I'm going to be like, if this is a one, then that's what we're looking for.
Um, wait.
I don't know. I don't know what this value is yet, but I'm sure it's not just going to be the best. It's going to be best plus some other junk.
So, let me say if it's a one. Um, but it's all the way at the left or if it's all the way at the right or it's there's a left and a right. So, if it's all the way at the left, then it second.
So, it's our current streak plus the right streak.
And this one is plus the left streak.
And then this one would be like uh plus that one and that one.
So, but that's just like one section, man.
It's asking for the maximum number of active sections.
So I think instead of just best I should also remember like something else. I'm not sure what yet.
I'm I'm going say OG ones and I'll count how many ones are in here originally.
Um, all right. So now we have the total original ones and then uh it's like I'm saying this maybe I should not count the current one streak in that and I should just count uh the the zero streak. streaks at the ends.
But man, something else that just made me worried about whether or not I'm going to get a a right solution is this part, man. With these ones at the end, I guess I just subtract two from my final answer. All right, so now we're just counting the number of zeros that we're flipping here. So then now we can just return OG1's plus best minus two. Maybe I think that's what they're telling me I got to do, man.
I'm not super confident with my code.
Everything's wrong.
Everything is too small. Small by two. All right, let me let me see what the hell is going on, man.
So this first one would look like I'm trying to do this without printing see outs everywhere. So this first thing would be like that. And then we'd compress it down to uh like one one uh 01 and one two that that's what it looks like compressed.
So if I were to go with my little weird algorithm, then if it's So this is a one and I'm going to say the best is one.
It's 1 + one that's two.
H I don't know as sometimes I say read carefully this statement. Hold on.
Let me read it one more time then.
Binary string of length n. One represents an active section. Zero represents inactive section.
At most one trade to maximize the number of active sections.
Return the maximum number of active sections.
After making the optimal trade, uh, Yin87, thank you very much for the follow.
Man, what am I missing in the problem statements?
The augmented ones do not contribute to the final count.
There's a condition on the trade.
Oh, this one. afterwards convert a contiguous blocks of zero.
So you're saying wait maybe I did um maybe I was trying some weird stuff man.
And the first one is not considered under conditions.
Yeah. If character is one. All right. I was trying something else. Maybe I'm trying to convert ones to zeros there. I'm trying to do it in one move, I think.
So, I'm saying if it's if the character is a one, then I'm looking for the zeros and the ends first two. Oh. Oh, wait.
I see what you're saying. But yes, I see exactly what you're saying. So those two ends don't count with this with this uh the block of ones that you can convert.
Um, dang.
But the zero thing is still for real.
So maybe All right. So we convert the ones first.
So I'm trying to find the biggest uh groups of ones surrounded by zeros.
I see.
So, it's just Wait, this is a little bit silly. I just hit them with the continue right there and there.
Um, all right. So, maybe that's it.
No, but then All right. 01 That's That's how it looks.
So I find one. So there's no one surrounded by zeros.
Um, how do you do this, Rex? I think I'm close, but I'm missing something, man.
I'm missing something.
One surrounded by zeros.
So, this should be remembering.
Well, this best is kind of weird. Maybe I should remember.
Maybe I should just remember the index.
I don't know, man.
Rexo says it's supposed to be an easy problem.
Um, ones to zeros, man. I swear I keep seeing the vision and then I lose it, you know? I'm like, "Yeah, that makes sense." In my head, I'm like, "Yeah, I know what to do now."
and then a few seconds later just slips away from my brain.
Um, let's consider that. Yeah, using these these ones at the ends are kind of tripping me up a little bit. So right now we are using them but sometimes it says we shouldn't.
You can just not take them. What do you mean like go from um uh since you'll be looking for ones first?
Let's look left and right.
I don't quite understand what you're saying, but let me think a little bit more about what I'm trying to do.
And if left right doesn't exist, you don't count them. So, it's correct since they would be ones.
I Yeah.
All right. Convert a continuous blocks of ones.
So this group of ones I'm to trying to convert is the biggest block of ones that is surrounded by zeros.
Um I don't know Rexo. I don't know if I want to try this problem anymore, man.
Feel like to just give up. But I I think um I can't stop thinking about like maybe I'm tripping myself up.
So, the first thing I'm going to do is find this block of ones that is surrounded by zeros and turn those into turn that into zeros.
So, it's like Oh, I see.
I see what I'm thinking, man. Like, I'm looking at example one and I didn't read the explanation. I thought they turn like one of these to zero and then turn both of them to one or something. But it says there's no trade possible for example one.
So, you need to find this block uh of ones to convert otherwise it's just the answer.
Yeah. the idea is correct. Maybe some Yeah, there's a bug in in like my brain, man. I'm not going to lie.
I think it would be best sometimes when I find myself like struggling to stay above uh water, I just delete everything, man, and I start over. It kind of helps me sometimes. So, I'm going to do that right now. I just delete everything and start fresh.
Anyways, here we go.
Wait, do I want to start fresh, man? All right, forget about the extremes.
Let's find the ones that are surrounded by zeros. Uh, wait, let let me not delete everything, man.
Let me just delete everything.
uh up to here. I think this part is all right. I count my OG ones. I'm not going to push back.
I don't feel like typing all this stuff again. That's the real reason.
I'm not going to set that previous to anything.
Actually, I'm going to set that previous uh to something that will trigger the else or trigger the regular if and I start my streak at zero.
So, if it's one, it will be a one here. Or if the first character is zero.
No, this this I'm I'm too rusty, man.
This should be the first character.
Yeah, you can set to S0. Yes, I'm just thinking that through, Rex.
Oh, man. Um, it must be painful to watch me try to solve this problem right now from your point of view, man.
I don't know how you got the patience to watch me make all these silly moves, you know. Anyways, so counting my ones. I don't know if I need to do that, but I'm going to do it anyways. I do the streak thing. I do the compression thing. I got the compression there. And this is without the ends. So now with my compression, I can look for the one with the zeros.
Um, uh, Rexo is used to what? What are you talking about? I see black deep.
Anyways, now I'm going to And do I skip?
Do I skip the ends?
Because the ends cannot be the end because if if the ones are in the ends, then they're not surrounded by zeros. So, I'mma skip those.
Right. And then I'm going say if he coached kids. Yeah, he still does. I think multiple multiple countries.
Um IC PC coach.
Wait, what? Um what was I trying to do, man? I'm trying to look for the ones.
I'm trying to say I'm trying to do this best thing again.
Wait, wait, wait. They It has to be surrounded.
So if it's a one and compressed I minus one will it can I assume that they will be zeros and I can just check maybe I don't need to do that check I'm going just say compressed I minus one Second, I think I don't need to specify those things, man. So, now I got that best.
Then I can just say maybe.
Oh, but if I don't find anything, then it should just be okay, right?
What are they talking about now, man?
Go to size, not end.
Jesus Christ, man.
Problem is so easy.
Like it's so simple.
What was I like? Where did I get tripped up, man? It's those dang ones at the ends that mess me up. And I guess not like fully understanding every part of the problem statement. Um, I think the idea was there, but just bugs like Rexo said, just bugs in in my logic or my code or something, but the idea was there perhaps. TJ Software, what's happening?
Oh, I spent a dang hour trying to solve the daily problem. What a joke.
What a joke I have become.
Anyways, let's do the virtual contest that I did not take because I'm a big joke.
Virtual. Well, the contest was 511. That just happened on Saturday.
I'm going to do it right now. The virtual.
You're going to tell you send your t-shirts back. No, man. I've already used those.
Hey, those t-shirts probably cost them like 50 cents to make in China, man.
They probably pay more for shipping than those things, you know? All right, here we go. Q1. Dang, what the hell? Q1.
Even number of night moves. You're given two integer arrays, start and target, where each array is of the form XY representing a, excuse me, representing a cell on a standard 8 by8 chessboard.
Return true if a knight can move from start to target in an even number of moves. Otherwise, return false.
notes a valid knight moves move consists of moving two squares in one direction and one square in a perpendicular to it.
Uh anyways, this is a tough easy problem, man.
How the hell am I going to solve this?
two moves.
I don't think I can think of any fancy way. So, I'm just going to I'm just going to do it.
Wait. Um, how do you do it?
I'm not sure yet.
Do I just give it an R, give it a C, and give it a K.
Start zero, start one, and K. Wait, what's target?
Oh, target is target. K is two. Two moves they say.
So, any directions? How do you do night directions easily, man?
I don't know.
I don't know how to do night directions, but I'll just look at this thing here.
So, we got -2,1 um kettle bear, what's happening, man?
Welcome to the party. So, we got -2, positive one.
We got uh -1gative -2.
We got negative one and two.
Then we have one -2 1 2 uh -21 -21 and -2 1. I hope that's right.
So, those are my night directions.
I'm trying to start from here. And we got two tries. So, basically, let me put some things.
I don't know if I should do it there or not.
or if I should be like so if R and C are at the target. Oh, not two moves, even number of moves, man.
Jesus Christ, they got me again.
So I guess we don't need.
Oh Jesus.
Um, how was your trip? Wait, that was sooner than I was expecting. What do you mean?
Like misreading the problem. Hey, trip was good, Castlebear. I think it gave me a nice uh refresher of what life is like out there in the world rather than uh in a cubicle in an office realizing you misread. Yeah, I I misread like every problem on stream, man.
Jagger Knights, thank you very much for the hydrates. Cheers.
All right. How the heck are we going to know if we can do it in um an even number?
Should I just call it par or something?
Um, so baller. Yeah, it was kind of baller.
Um, I ate a lot of sushi. I ate a lot of Wagyu, like yaki niku. I ate a lot of Domino's and McDonald's, too. I'm not going to lie.
Uh, a lot of Cocoa Curry House.
A lot of uh yeah, that's about it, man.
Lots of sushi for sure. Lots of 7-Eleven and that type of stuff. Saporro and sake. Yes, I drank a little bit of beer, but maybe more asah, but I drink whatever, man. I'm not a beer snob.
I drink anything. Well, I don't drink actually, but when I do drink, it's whatever. I don't care what it is, but I don't drink anymore.
Anyways, um, what am I trying to do? The parity thing.
I need some type of C. Do I need a cash so I don't end up in a forever loop?
This is a lot to type for a easy problem. There must be an easier way to do that to do this problem. You know, maybe I'm like overinking, man. Maybe it's some easy thing like like who knows what.
Do you smoke any ganja? Not there, man.
I took a break.
Um, I smoked the daily, but that 29 32 was rough. What you talking about, man?
Smoked the daily.
Tight blazer. Oh, tight blazer. Oh, yeah. I remember now. That Mount Everest thing. Dang. Let me check it out. I did it earlier today.
Dang. You got lucky, man.
You got super lucky.
Anyways, good job. Good job.
That's what you smoked.
And let me solve this problem real quick.
Oh, this problem needs to be Vector, vector, vector.
Um, this is too much for Q1, man. Like, what the hell?
Um, why wouldn't why did I do it this way and not BFS way? But anyways, so what I'm going to say zero is odd, one is even.
All right, here we go, man. So, so those are my new directions going through every direction we can go to.
Let me check inbounds.
Um, is this a cash? It's really a scene, man.
Should I just have it as a bool?
Um, Dazzl 3636, what's happened? Welcome.
All right. So if the cash if we've seen this one how should I do the parity?
I should flip it.
I think so.
What am I working on? I'm doing a leak code contest that just happened over the weekend. Contest 511.
I'm on the first problem. The first problem is usually easy, but this one is a little bit more challenging for me than usual.
Um, should I return true here or do some junk like this because I'm lazy.
No, I can I can do that. Um, I can do that, man.
I don't really need that then. But I'll just leave it.
Come on, man.
What happens if I win? Uh, I'm definitely not going to win, but the contest is already finished.
So, um, like the person who won the contest is already known and I'm nowhere near good enough to win a leak code contest.
You basically have to be super duper cracked. One of the best in the You got to be the best League Code in the world to win a leak code contest, you know.
Um All right.
I should mark the first star thing as scene probably.
with zero paracy.
I don't want to redo that. Right.
I don't know if my piracy is good there, but we'll see.
It's too hard, man. False. False. What?
Are we still doing leak code in 2026?
It looks like we are, man.
How am I doing? I'm doing leak code. I'm chilling doing leak code.
I don't know what's going on. I try not to do this, but I'm going to do it because this problem's too hard for me.
And it's Q1 in a contest start. Hey, how come? Oh, this is example one.
So they say start there target 22 there's so one one to two three do I have my direction it doesn't matter X Y or C whatever right long as I keep them the same.
Um, when does one stop doing leak code?
Yeah, who knows, man. I'd say he stopped doing leak code if you don't want to become a software engineer at a big tech company anymore.
Or if you don't want to be a I don't know. I don't know when you stop, man.
Whenever you feel like to.
Can't solve le code mediums without looking at solution. That's how I feel these days, man. Um, Lucas from YouTube, what's popping?
Solution.
What? What is that?
Is that boobs or whatever?
in the calculator.
All right, here we go. Here we go.
1 one 32.
Do I have the parities right? Let me just switch them to see what's up, man.
So, true and true. So when I flip it to one, what the hell?
They should like flip it every time.
Yeah.
All right. Um, look at that two right there, man. Oh, that did say true though. That did say true.
Oh, you know what I should do?
Forget this par thing. I just print the RC right here in the beginning to see what's up.
So, 22 is there um for sure.
I don't know how they got there because how do you go from one one oh one one these anyways test case two says false and I'm saying false there.
I don't know how to debug um what I'm doing wrong, man.
But I'm clearly doing something wrong. Or when I hit this 22 par maybe this um Oh, should we start at par zero?
has zero moves you're going in there.
Yes. And then the first move you do is an odd number of moves.
And then so this is saying one, two, three, four moves. So this should be all right then.
I don't know man.
All right, let me move on. Q Q1 got me struggling, man.
Absolutely struggling with everything leak code right now. All right. Count dominant nodes in a binary tree. You are given the root of a complete binary tree. A node X is called dominant if it's value is equal to the maximum among all nodes in the subree rooted at X.
Okay. Return the number of dominant nodes in uh the tree.
So this one I got five dominant nodes.
Each leaf node is dominant.
I see. So the roots uh Hector Hsc, thank you very much for those bits.
Bits.
Hector HSC one hundo. Thank you so much.
Look at all those awards. Thank you very much, Hector.
Here we go again. Um, yes, I can do this one. This one is easy, right?
DFS or something.
Um, how am I going to do it though? I'm going to DFS. Yes. So, I need I need each node to return its maximum value in the subree.
So, maybe instead of returning nothing, this should return I'll check.
All the node values are positive. So I'll just return zero.
And then um I guess I go left and I go right and these are going to return uh the maximum values there. So then what do I return? I'm going to return the max of left and right and then the max is the max of uh max and then the current node that we're at. So now I'll just count like this man. So if this maximum is equal to the node value, excuse me, then let's increment our answer. And then here we're going to return that maximum value.
And I think that's it.
Um I just call the DFS on roots and return the answer.
So, I should get five and four. And I get five and four. And I'm Am I confident enough to send it?
Sure.
All right. Q2 is easy, man. How the hell am I still struggling on Q1? That's crazy.
My keyboard sounds like candy extreme.
Yes, thank you very much.
Wait, how do I say keyboard?
Pixel pusher, what's popping? And what's happening from YouTube? Drove Balian, how are you doing? Pythagorean theorem. What?
All right, so that's Q2. Not bad. Pretty easy problem, I'd say.
Q3. Um, transform binary string using subsequent sorts.
Hey, Pix Pusher. I'm struggling with leak code, man. That's what I'm doing. I don't know what you've been up to.
All right, let's see.
Binary string using sequence sort.
You're given a binary string S.
You are also given an array of strings stirs where each stirs I has the same length as S and consists of character zero, one and question mark. Each question mark can be replaced by either zero or one.
How can you do that?
Uh what's happen or whatever?
What's the secret to my hair? Punit, how you doing? The secret to my hair is I think I got it from my mama.
So ask her, man. I don't know. I don't do anything to my hair except the one thing I do do is I don't cut my hair.
That's it.
Um or the one thing I don't do, I guess.
Anyways uh so we get a bunch of strings each string has same length and has 01 and question mark. Each question mark can be either a zero or one. You may perform the following operation any number of times including zero. Choose any subsequence of S. Sort sub in nondereasing order. Replace the chosen subsequence in S with the sorted sub keeping all other characters unchanged.
Return a boolean array ants where answer is true if it is possible to replace all questions in stars I with zero or one and transform s into the resulting string using the allowed operation above otherwise return false.
Um explain logic behind that. Hey, I don't fully understand the problem yet.
Stirs.
Stirs. That's what it says right there, man.
Uh, playing chess gives you a bit of an advantage with the Q1, but the trick is also observable. Yeah, it feels like there must be an easier way to do that problem, man.
Knights always also hit between square colors on their move.
I didn't know that. Um, but I'm not going to try and use this trick. I'm going to go back and try and solve it with whatever I was trying to do, man.
But interesting. Knight reaches a target in an even amount of moves. Target must be same color.
I guess that is a little sneaky, but I don't play any chess.
Can you do that in Java? No, I don't know any Java, man.
Bro can't even solve mediums with ease and is teaching on YouTube. Yeah, that's how it is. That's how it is sometimes.
All right. So, let me try and understand this problem.
101 they give these strings we return true true false so place this with a zero.
Why you talking about sorting though man?
Zero question mark one 011.
Select the subsequence at indices.
All right, this is my string.
So you sort them.
And this problem seems too hard.
zero question mark zero not feasible.
I don't know if this one is the one for me, but N is only 2,000. So maybe um N is what? How many the length of s and then the strings length is 2,00 h um punit please appreciate his thinking ability. We can learn from him the way he thinks. Read problems out loud.
Sometimes easy looks hard. Yeah, thank you, Punet. But that's how it is sometimes, man.
Um, all right.
I'm pretty stumped on this problem, though.
So some observations I guess we can make is we can sort any substring of S.
So here if we sorted the whole thing then anything with all zeros before ones is possible.
Man's so many strings they give here.
How will we know if one of these All right. How can we know if a single string in stirs is possible?
Well, if everything except everything matches up in spots that aren't question marks, that means it's possible.
Um, oh wait, it says choose any subsequence, not any substring.
So subsequence, sourcing the subsequence. That sounds a little funky.
Let me see what that really means.
Wait, what?
Sort the subsequence in nondereasing order.
I think whatever sorting a subsequence means probably makes this problem a little bit easier. What does it mean?
It means it basically means we can put we can shuffle some zeros and ones around, right?
It's like if we were to sort this subsequence.
Yeah, I guess it's kind of just saying you can swap zeros and ones positions or something like that.
Um, let me look at let's say example two. So the original string is this.
The first one is They say true.
So you select everything and sort the whole thing. So it becomes true.
This one is not feasible.
All right. Not feasible.
Um, if the count of ones or zeros is more than what's in the original string, it's not feasible. Like this one has uh three ones. The original string only has two ones. So, not feasible.
Philly MCV, thank you very much for the follow.
All right, this one says it's true. So number of ones are equal and number of question marks are there. So it's it's basically one zero one zero.
And how do we get that?
We sort this subsequence.
So it becomes one zero zero one. Wait one. No, no. We sort this subsequence.
One, zero, one, zero.
No, wait. What am I saying, man?
Yeah. Yeah, that's that's what I'm saying.
I don't know if I can do this problem, man. It's too hard for me.
Um, but apparently it's not hard for 6,000 people out there.
So, I I think I can get some of the false cases by just counting the ones and zeros, but I'm not sure how to say we can match it.
Some thousand cheaters. Hey, Pixel Pusher, did you do this contest? Can we think with you? Standard backseating streamer preference question. Um, generally I don't mind some backseasing if you give me a chance to solve it. And I think I've had enough time to think about this problem where I can say I'm going to need some help. This one is this one is challenging for me. 100% sure. I'm not certain what to do, man.
Yeah, this one took me a while. Q4 was more intuitive. I mean, if pixel pusher is a dang le code beast, le code guardian and he's saying Q3 made him struggle, too.
So, man, right now I'm only a Q1 gang or one Q gang because I couldn't even get Q1 right after all my junk.
Think I can get this after simplifying it?
Um I um I the problem is I don't know if I want to sit here and try and break it down too much.
If it was like a real contest, maybe I'll sit down and really think, but it's hard to get to that level of focus when nothing is on the line.
Um, all right. I think the cases where one character is above the original characters, we can just false it out immediately.
the case where there's question marks.
Maybe we should find out um how many more characters are missing from the original and then assign those question marks to what they could potentially be.
Um sourcing any substring to me sounds like it means that you can replace any zero with any one on the to it to to its left.
That's what sorting a subsequence sounds like to me.
Or no, it's deeper because All right.
If we had 0 1 as a subsequence or not zero one 1 zero then it could we can shift it to be like that.
So the middle one doesn't change and we basically just moved the zero to the left and the one to the right. We could also have one zero and those would just be 0 one.
Um I guess if we had one one zero then yeah. So it's like we're able to replace any any zero with any one and swap them on the left to the left of it. I think that's what sorting a subsequence means.
Uh, Kettzle Bear, good luck with Q3 and eventually Q4. Have a good night. I'm out. Hey, Kasle Bear, thank you very much for tuning in. I'll see you next time, man. Adios.
Um, all right. So if the problem says that instead of the sourcing thing then how do we know if it is possible?
Do we have to count how many ones to the left?
I don't know man.
Um like in the in these examples all the sorting that they do are like substrings instead of just subsequences.
Um, all right. So, if I'm iterating over this string and I'm trying to check 0011 And I see a zero.
Maybe I count how many zeros to the right of an index and then I can like figure out if I can swap them or not. Um, Muhammine Zaman, how you doing? Welcome.
Message retracted. See you later.
All right, let me just let me try and science it out, man.
I'll look at example two.
So, I'm saying if we count how many zeros to the right? Two zeros, two zeros, one zero, zero zeros.
And now if I'm looking at this string, this is stars I um and then we come across this.
It should be a one, but it's a zero.
So, we say there's two zeros to the right.
We should swap them. So, I'mma swap them.
And then now it goes to this one. It should be a one.
Um, but it's a zero. And then we can see we have two zeros to the right and we use one zero. So there's actually one zero maybe. I don't know if I'm doing this right, man.
I don't I don't know if this is the way, but there's one zero left perhaps.
So, we swap that one too.
Then we continue.
Um h all I can think of is how to brute force it. Is performance considered? Uh yeah, performance is for sure considered. They give us the inputs. So it's going to be the string length is 2,000 characters and it's uh 2,000 strings of 2,000 length as well.
So, you have to like check all of those things.
CM Griffin, thank you very much for that raid. How are you doing? What's popping?
Happy New Year and merry Christmas. How you doing?
Welcome to the party.
Are you been a while? Yeah, it's been a long time. I took a break from streaming for a little bit, only for a few months, and I just started back recently.
Uh, Kenneth Yay, how are you doing?
What's popping?
Right now, I've I've been doing League Code. I don't really change what I do on stream, but I'm trying to do a contest that just passed over the weekend, weekly contest 511, and I'm struggling. I'm not going to lie.
Uh, thank you very much for those follows. Extreme. Yes. Mullen CM Griffin. Thank you very much.
All right. How you doing, man? What's been popping?
Been vibe coding. I've been enjoying uh Fable or Opus or whatever is bumping these days.
All right, I'm not sure if I'm going to be able to solve this problem. I'm not going to lie.
Been well, just building stuff. Recently tried out uh schema thesis for open AI validation.
Not sure what that means, but it sounds fancy.
Done a bit of vibing, but still coding for things I care about sometimes. Yeah, the only code I do is elite code. Man, I don't even write code anymore anywhere.
Open API is a spec for REST APIs. I see.
Sounds kind of like open AI, but I guess it's not. Maybe it could be.
All right.
Um, people telling me Q4 is more intuitive than Q3. So, maybe I'll just jump ahead and try and do Q4, which is hard problem.
This whole contest I'm struggling. All right, here we go.
Minimum number of string groups through transformations.
Open API used to be known as swagger 10 plus years ago. I think I've heard the name swagger, but I don't really remember.
Interesting.
Um, yeah, vibe coding is crazy, man. It's crazy how wild it has become.
uh or how capable things have become in the last even just like year or so less than a year man.
All right, let's read. You're given an array of strings words. Define a transformation on a string S as follows.
Let E be the subsequence of characters at even indices of S. Let zero be the subsequence of characters at odd indices of S. I guess that's an O. Independently uh cyclally shift E and O by any number of positions to the right possibly zero independently. Interesting. Reconstruct the string by placing the shifted E characters back into even indices and the shifted O characters back into odd indices. Two strings are equivalent if one can be transformed into the other by a single transformation.
Partition words into the minimum number of groups such that every string belongs to exactly one group. Every pair of strings in the same group are equivalent. Return an integer denoting the minimum number of groups.
Going to go make food and lurk. Stop distracting me. All right. Well, thank you very much for the raid. Enjoy the food you're about to make, man. Thank you. See you later.
CM Griffin everybody.
Um I don't quite understand the problem but uh let's look at example one. These are the words they say. The minimum number of groups is one. All right. Anytime I see minimum number of anything, I'm always thinking about binary search immediately. But I don't know how to apply anything here yet.
So these are the words I say one because for this even indices are that odd indices are this.
Shift that right.
Oh, I see what they're saying.
Uh yes. And shift that right by one to WT.
And then you reconstruct interesting.
Okay. And then they're asking um how many of these can we make in the same groups basically.
So if one string is equivalent to another string that means like if a equal b and b equals c then a must equal c.
How am I going to solve this?
Basically, I need to check that um odd and even indices are similar in the strings.
Bang. 500,000 characters.
All right. How do I do it? How do I do it, man?
A BB and BBA are considered the same group because AB is for even and BA and you just cycle them once to get to the answer there.
All right. I think what I'll do here, I don't know if it will be fast enough, but if I sorted all odd indices and all even. No, I can't sort them.
I can't sort them because that will mess up the order.
Um, but if I just cycle them so that they're like lexographically smallest or something like that.
But the length is so large, man. Um, word's eye wait's eye length is really really large.
Um, so if we get our odd and even indices and then hold on, I got to pee. I'll be right back. One second.
All right. Um, I'm back.
My solution to this problem would be to take a sick day and have a coworker take that workload from me. Dang, that's probably my solution right now.
This problem does require string hashing.
You don't need rolling hash though.
Dang. Well, I don't know any string hashing, man.
H. But let me think. String hashing.
Um, so if I had the strings hashed, what is it like a prefix sum?
um type string hashing where you double double the length of the odds evens and you do a prefix sum because as you hash the hash gets bigger but you can look for your target because you know I don't know that's what goes in my mind but I don't know how to do any string hashing so I think maybe this problem is beyond my abilities.
I really should learn those things, man.
It's been years that I've been saying I should learn so many things and I haven't learned anything.
I'm still running on uh 2021 knowledge, man. I don't think I've gotten too much more knowledge since maybe a couple things.
All right. Yeah, Pixel Pusher, you can give me the idea for sure. You can back seasing Q3 Q4 right now for me on these problems is completely fine man.
This this dang contest has been a struggle. Look at that.
Dang. This this would have been easily my worst performance in six years of contests, man.
Um, Dev Corada, thank you very much for the follow.
Even Maxis in Q1. Yeah, I guess.
So, if you have some string A, B, C, D, all cyclical shifts appear in the double string. Yes, I know this double string and cyclical shift stuff, right?
Uh, there is a similarity between those two strings.
Um, all right. There is a similarity between this string and that string.
Um, all right. Let me try and think about that. I'll I'll let you know when I give up the puzzle.
So if we're hashing these two things I don't know man what I was thinking originally was like if you have these two are clearly they belong in the same bucket.
because you can see ABC D right there.
So I was thinking um like you take you take the hash or whatever of just A B C D and then for the double string this is our target. So like let's say the hash of this is I don't know 23 or whatever um student of etses how you doing welcome all right let's say this hash is 23 so I was thinking like to do some type of prefix sum you know so if this first hash of just the d is seven and then over here is like 30 or whatever. You know, our target is 23.
So, we're like looking back and we can see, oh, there's a hash right here.
But that's where my mind went immediately.
But I don't really know how hashing, like string hashing works too well or anything. Um, let me see what other similarities I might be able to identify here.
I mean, besides uh besides that they contain the same letters, I don't really know some. Yeah, I give up. I give up pixel pusher. I don't know what it is.
One of these days I'm just going to sit down and learn the dang string hashing algorithms, man.
Dang, what a bad performance on this contest.
like every recent contest I've taken.
Really?
Wait, what are you saying? Maybe take something like DACB, which Oh, wait. Take something like this, which is not rotatable by that. Wait, what am I looking for?
I don't even know what I'm looking for.
Um, oh, so he's saying hold up.
D A B C D A B C.
If you look at A B C D versus D A CB versus D ABC, they all have similar letters, but only one of them is similar, right?
Yes, but I don't know the simp like I don't I don't know what I'm looking for, man.
That's an easy problem. Yeah, Rexo loves to come in here and tell me every problem is easy, man.
I'm not sure if that's always true, though. Easy for sure for some people.
All right, Pix Pusher. You're just going to have to spell it out for me.
So, what is uh if there is a solution, I can send it.
Hey, thank you. Hey, Q. Ultimus, what's happening?
you need to know a particular algorithm.
Yeah, I I hear what you're saying. So, if you knew this algorithm, it's like simple. But if you don't, um, basically there's two similar ones both contain a b c d, right? I mean, of course, of of course they do because they belong in the same bucket, right?
They'll all have the same lexography minimum substring of the size before you double it.
So you're saying um just take just double it and take the lexographically minimal.
I guess I was thinking about that but I wasn't sure how to do it.
Um yeah, sliding window. I see what you're saying. I see exactly what you're saying now. But I feel man um that can't be a man.
Will I pass?
So you did this with sliding window.
Uh where do you get your keyboard? Are you only studying le code? Uh yes. I don't really study. I don't I wouldn't say I'm studying le code. I'd say I'm just um trying to solve some problems, but I'm not like studying to get better really. I'm just I'm just playing the game, you know?
All right. Sliding window. I can do a sliding window.
I can do a sliding window, but I've had some trouble with this in the past with string problems.
Anytime I try to uh compare a substring of in C++, I always get like time limit exceeds or something because I think like the substring is creating a new string from that substring every time I check. I don't know. I've had this problem for a long time. Anytime I do anything with substrings in C++ and I'm not sure um how to go about that, man.
Maybe I'm just bad at C++.
As my grandpa says, strings is another world. What is your grandpa talking about, Rexo?
That's why you need a rolling hash for a number instead of a string.
Right. So, you're saying that uh making the copy of the substring is quite normal then.
There are other ways. Yeah, there's a lot of ways.
But that's what I was thinking um earlier when I was talking about the prefix sums with the hash. I guess the the hash would be like increasing, but I'm not sure how that works, man.
With like all the mods, if you have to do any mods or whatever.
String have nuts. What? Hey, Q. Do you know Rolling Hash and Stephen Sagball?
How you doing?
Long time no see. Hey, I'm not going to lie. Steven Sagall, I don't even rem I don't remember if you stopped by today or if you must have been here earlier, man.
Or Yeah, come on. Of course you're here earlier talking that nonsense, man. I already forgot.
Um, all right. So, I'm going say Q4 is not within my reach because I don't know rolling hash or any string algorithms or string hashing algorithms. It's on my list of things to know, man. All right, so back to Q1, man.
Dang question that I can't believe I can't get for some reason.
Um, can I move somewhere in an even number of moves, but um, my thing is saying it's wrong.
Q1 is way easier than you're making it.
Yeah, Pixel Pusher already told me, but I'm I feel like I still should be able to solve it with uh whichever way I'm doing it here, you know.
I think it's still good practice for me.
Yeah, you know that friend you made me reach out. I didn't No, we ain't friends. And I'm talking to his wife still. Is that weird? Yeah, that is weird, man. And I don't know why I keep talking to these friends of yours. Can I give a hint? Yeah, Q. Give a hint because I already kind of moved on from this, but Pixel Push already told me that if you move one or two.
Yeah, Pix Push already told me that. Um, anytime it moves, it changes colors.
So, if you move twice, then it's like on the same color again. you know that it started with. So I guess what that means is like if the colors are the same then it it is possible.
Um but is that That can't be the only way to solve that problem, right?
Like I was thinking for sure I could solve it with this way, but now maybe the parity thing is messing me up because there could be a situation where it it went to that thing with that parity.
But uh there's like other moves you can do before you reach to the target. You know what I'm saying? So maybe this this solution might just be incorrect with like cashing on the party like that. Hey Brett, what's happening man? Um do you see the quick answer? I didn't see it, but everyone's been telling me.
Um, all right. Oh, Q and Brett. Let's see.
Let's see them both because this whole contest is crazy.
Uh, just in case you want to see, I saw this on the contest. Very nice.
All right. So, he's telling me if it's uh what color the starting thing is, what color the target thing is, and if they're equal to the same color. Yeah, I didn't I didn't know that, man. That's what Brett did, too.
Like, how are you supposed to know this though?
You know, if All right, I don't really play chess. I know the rules of chess, but I've never like studied chess or anything like that. It feels like a tough question for a Q1 though.
Um, knight can wait. A knight can get from any square to any square, so you just need to match colors. Yeah.
Wait, what you laughing at, Rexo? You think this problem is funny? You have to stare at the example image if you don't know chess.
Uh, the thing is that since you move always one by two or two by one, then your X + Y parity changes in one move.
It's what it takes to get internships now. Got to be a chess grandmaster.
Hey, uh, background store. What's happening? That's what it seems like, man.
Has anyone interviewed recently out there?
Is it tough? Are the questions crazy these days? Play chess on stream. I'm not trying to embarrass myself, man.
Hey, who used to do it? I think Pat's Hello World used to do some chess racer thing.
Um, and every now and then I jump in when uh Pat did it and like I don't even know what the hell I'm doing, man. Like I don't even know what the game is like.
I'm just moving random things and I always lose. I don't even know how the hell to play chess like that, man.
The fact that uh color changes each move isn't hard to see. Maybe a little trickier to see that all squares are reasonable. Yeah, I didn't know that a knight can get basically anywhere.
I I thought maybe it's not possible sometimes, you know.
Um, spirits of Raia or spirits off Raia. What's happen?
I'm a math grad. Any tips on how to approach problem solving on le code to maximize roots learning?
I think if you studied math, you have a big advantage for leak code because a lot of the problems do have some type of math involved, whether it's combinotaurics or statistics or something like that, man.
And I guess some of the dang DP stuff is like mathy when you're talking about uh the functions or whatever the recursive functions and you're trying to build them.
It's free. I see. Um but any tips on how to approach problem solving to maximize root learning? I don't even know what type of tip that would be.
Um, but if if you just want some tips in general on league codes, I'd say uh build a schedule for yourself and stick to your schedule. Treat it like how you might treat uh tennis practice. You know, if somebody plays tennis and they're trying to get better and they have a coach or something, they probably have like, oh yeah, every Monday, Wednesday, Friday at 6:00 p.m. I go play tennis.
Uh so I think for elite code you got to have some type of strict schedule that you uh respect and if you say you know I'm going to study every Monday, Wednesday, Friday and Sunday night at 700 p.m. then just do it. You know I used to beat them I used to beat them in chess racers. Yeah.
Um, wait, what something? Aren't math majors pattern wizards? Yeah, it seems. So, I think I wish I was better at linear algebra.
You know, I took linear algebra in college, man. I don't even know anything from it, though.
Standard tips solve problems. Yeah, that's basically the best leak code tip.
Did you get Q3 on this contest? No, I didn't, man. I only got Q2.
Q2 and that's it. Q2 was like the easiest problem for me.
Q3, I don't even know, man. This whole contest was tough.
Um, linear algebra just applied stats.
Oh no.
The fain man algorithm. Write down the problem. Think really hard. Write down the solution. Tibu coder, welcome to the party. Thank you for dropping some knowledge on us. Linear algebra is a good thing to be better at. Maybe the most useful math.
What?
That's crazy, Brett.
That's crazy that linear or that you consider linear algebra to be the most useful math, but I have no idea what linear algebra is for.
I just know that like uh computer people study it sometimes.
Um what about numerical analysis?
Wait, it's a long one line code. Which one you talking about? And if Q1 is a one line. Yeah, it's vectors. VE 3D graphics.
Vectors.
All right.
I'm trying to go back in time almost 20 years ago.
I'm sitting down in my linear algebra class.
Everybody failed the first test. That's the only thing I remember except maybe me.
I remember the homework was so hard.
Everybody failed the homework too, man.
Except me.
But I still don't remember anything. I think I tried really hard in that class in the beginning and it was a lot of programming stuff.
I don't remember except it was a tough class. Um, why doesn't the Hankko transform reveal an upwards frequency shift? What are you talking about, man?
Uh, some stuff are so large that you can only reliably navigate through it with linear algebra.
Yeah, don't defense.
What's popping? Everything is a oneliner if you try hard enough. I see.
Um, all right.
Linear algebra. I do remember doing a lot of matrix multiplications and stuff in linear algebra.
Um, I don't remember how to do that though.
But anyways, uh, Dia Barla, what's happening? You're doing a great job. Hey, thank you.
Thank you.
All right, let's move on from this contest. Man, I basically bombed this one.
Um, what time is it? I don't have time to do another virtual contest.
Maybe what should we do? You guys want to try elite rooms for old time sakes?
How do you do this?
One elite rooms if anybody wants to do some problems.
And then I got to go.
All right. So, four problems.
Probably not going to get through all four.
Um, Brett, welcome.
All right. Simplified fractions.
I'm not doing that one.
Maximum bag with full capacity of rocks.
Maximum prime difference. Maximum number of alloys. Which one? I'm going to try this uh Q2. This bag one. Q. Welcome to the room.
Maximum bags with full capac. I've already solved it though. Let me see when.
a year and a half or so. I think I can do it again. You have n bags numbered from zero to n minus one. You are given two zero indexed integer arrays capacity and rocks. The i bag can hold a maximum of capacity i rocks and currently contains rocks i rocks. You're also given an integer additional rocks. The number of additional rocks you can place in any of the bags. return the maximum number of bags that could have full capacity after placing in some additional rocks.
Oh yeah, I think I can do this one, man.
So, so I'm just going to iterate through all the rocks and see like how many each bag, how much more they can hold.
Um, so it's capacity I minus rocks I. That's how much you need to fill that bag.
So I'll do that. Um and then I will sort this is what do you say is this like greedy or something?
So, I sort how much we need and then I'll iterate through all of the needed and I'm going say if if it's zero then that bag is already full and we don't need to do anything.
Otherwise, if how much we need is less than or equal to uh additional rocks, then we can we can fill that thing and subtract how much we needed.
And that's it.
too easy.
Um, oh, Rexo is in the house, too.
All right, Q2 was too easy, man. Not enough. That's That shouldn't even be a medium. Or I saw this one, too. Come on, man. Two years ago.
Um, all right. I'll try and do it again.
Uh, maximum prime difference.
I don't want to do prime numbers, but I'll do it. You're given an integer array nums. Return an integer that is the maximum distance between the indices of two, not necessarily different prime numbers in nums.
Hm.
300,000 numbers, but the numbers are only one to 100.
So, all right. This is I don't think we need to do our civ of aeratos here, but I think it's good practice.
And I didn't understand the question.
Hey, which question? the previous question.
Background store or this one.
Um I can send you this.
Oh, this one.
Uh I guess it we can look at examples.
So it's saying the biggest distance between prime numbers. The answer is three because the prime numbers are two, five, and three.
And uh the distance here is three because this is position four one. So 1 2 3 that's how far the two prime numbers are from each other.
So basically this question is asking um the leftmost prime number and the rightmost prime number or something.
Uh but I saying it's good practice for me to do my civ of error toss the sneeze here because I don't get to practice it too much. So I'll do that right now.
Well at least I'll try.
So, how does the civ work? Um, I always forget, man. Do I say this is is prime?
And we'll just go up to 100, I suppose.
101 for good luck.
Let me think how does the civ work. So we start from two and we want to like I guess hit. No, these should all be false.
And then I'll have vector in or I'll have a set actually of all the primes.
And I'll say if is prime is false, which it is initially.
Maybe I should not call this is prime.
Um, not prime. I forget how to do the civ, man.
Wait, maybe I'll set all right, the naming is a little strange, but I'll set everything to true initially. So, I'll say if this is true, then this is a prime.
And then I'm going to go from uh J equal I * I and then mark everything J as false. Is that how the civ works?
I think so, man. And then now I have my set of primes. I guess it should be insert.
And then um and I guess I just find the two primes at the ends.
Uh, so how should I do that, man? Should I do it like this caveman way? So, I'm just going to go left to right and then right to left. And the first one I get is what I'm looking for.
So if primes dot I guess we can do counts or what I'm going to use find um what are we finding numsai gamber is Cool. Thank you very much for the follow.
All right. So, if it's if this number is a prime number, then we just mark the left and then go from right to left.
What if there is there's at least one prime they say?
Then I just return right minus left.
All right.
Um, how many Google shares do I have? I don't know, man. I got enough though. I probably got a lot. A lot of a big percentage of my net worth is Google shares. Maybe it's not a great move.
Wait, what are they talking about?
How come this is zero, man?
Is my civ incorrect?
It must be.
Oh, J++.
Jesus Christ.
Um, my civ was incorrect, but now it's good, but it's still slow.
Rusty Hots, what's popping? Just got here. Isn't this just finding the first and last prime number in the array? Yes, that is what I did.
So, well, first I made a list of the prime numbers possible. And I did this to practice my civ.
And then, good thing I practice it because I made some silly mistakes.
And then I'm just going and find the left one and the right one.
Um, is the lead room server down? Hey, you might be right because nothing's showing up in the scoreboard, man.
Yeah, it looks like there's a problem, unfortunately.
Wait, what have you been working on? Uh Jake Castile, how you doing?
What have I been working on? Uh you mean on stream? just solving leak codes off stream.
I've been working around the clock on a few things including Algo Blazer. That's where I spend most of my time these days, man.
I've been doing a lot of Algo Blazer work. so much work on Algo Blazer that uh I think I'm almost ready to I wouldn't say launch it, but just put it up on the internet and then opening it up and maybe start using it on stream. But maybe in the next two or three weeks I'll do that.
Um we'll see. We'll see. I feel pretty good about where it is at right now.
I think I'm mostly working on like I wouldn't say the technical stuff on the website, more like the content on the website. That's what I've been spending my time doing.
Do you wait do a strangely large proportion of the problems relate to Roger Federer?
No, they don't. I know what you're talking about though.
Join my startup is about saving bees.
Yeah, I would like to save the bees.
Yeah, elite rooms is having some issues.
Should we ping Flumsy?
Does Flumsy have a Elite Rooms uh hotline?
Um, still coding late. It's not that late.
I'm about to end real soon though. Maybe needs an update on how it register submissions. Yeah.
Either way, um, I guess you can the chat still works, so that's nice. But perhaps it perhaps leak code changed the way they submit.
Maybe like it was hardcoded. I mean, for sure it's hardcoded to detect a submission, but maybe they changed it because I see now when you submit something, it gives you this little spinning thing. Um, so it seems like they changed a few things on leak code that could perhaps break elite rooms. You know, that's like if I had to guess.
Hello from Mexico. Hey, uh Brian Hernandez Mora, welcome.
What's popping, man?
Anyways, so we did I guess we did Q2, Q3. Let's try uh Q4 here.
Uh, don't destroy their nature and they should be fine. They don't need saving.
We humans need to be less about nature.
What?
RPC2.0.
What's happening?
Um, our company is still asking leak code questions. That is a good question. I don't really know man. I think some companies for sure ask ask le code questions still but um it feels like there is more now in additional to just le code.
From what I've been hearing, uh, you're still expected to do a few leak code rounds, but you're also expected to do maybe more system design now than ever before and maybe maybe even like an AI round these days.
Uh, I've heard of a lot of um just like low-level design type programming also out there.
But it really depends on which type of company you're applying for. If you're applying to the big tech companies, Google, Amazon, Facebook, Microsoft, I'd say for sure there's like a 99% chance you're going to run into at least two or three le code rounds.
If you're applying to a small local company or just even a small company with like couple hundred people or less, uh, who knows what they ask? It's so random at that level that you could get asked Lee code, you could get asked uh like trivia or something, you know.
Um, any major update on Type Blazer? Yeah, uh, Type Blazer is still up and running, man. That's about it. Um, I've shifted most of my cycles off of Type Blazer and onto Algo Blazer, but I'm trying to find a good balance where I can work on both of them. At some point in the future, I will probably bring back uh working on Type Blazer on stream, but right now or at least in the next week or two, I don't see that happening. Maybe maybe sometime later this year.
Um a solo sword, what's happening?
commented on your live stream before six, seven months about master's admission. Well, I have good news. I got in.
Hey, congratulations, man. That's that's big.
If you remember me, uh if you remember maybe I asked about how to get a voice like you.
Yeah, I got it from not my mom.
Maybe maybe my dad.
Um anyways, anyone face interview where they allow AI and they judge the interaction and then review the code quality outputed?
I have not, but I've talked to a few people who have done AI rounds. And I think I think the AI rounds are tough.
From what I've heard, man, some people say that, yeah, you're allowed to use AI in those rounds, but it's it's like if you use it, it's like a catch 22 or something. Like, if you use it, they don't think you're good enough. So, just don't use it. And if you can solve their problems without AI, that's probably best. Um, but I think it's so early in in like companies trying to figure out how to test AI usage that things are going to be all over the place right now. Um, and it could change next week. And so, so no one really knows yet. There hasn't been like an established standard for AI rounds, I think.
But it's tough because it's such a new technology.
small company doing Java back end. What considering le code is never a waste of time because it's helping you improve coding skills. Yeah, I don't know if coding is necessary in the future, man.
Based on the pro progression we've had in the few years, you know, any Rex on where to practice system design?
I think there are tons of YouTube channels dedicated to system design.
uh websites too. Some of them ones I've heard is like Hello Interview.
Uh there's some YouTuber that's been doing system design lately. I forget his name, man.
But I don't really study system design very much. Um trying to create an Type Ber account after doing the daily challenge at getting first so I can brag to my friends. I'm not receiving any emails.
Uh there is no emails, man. So you can just sign up and you can just use the account without confirming I think.
So just sign in with whatever you put your email password as and I think it should work.
Uh sir data, what's happening? I'm doing all right. Just subscribe. Thank you very much. Excited to be here. Can I get your LinkedIn? I don't give my LinkedIn out publicly, but my LinkedIn is junk anyways, man. I don't even log into LinkedIn. If you want to ask me any questions or anything, I think the best way is to just message me while I'm on stream or leave a comment or something on one of my videos and chances are I I get towards reading them or on my website, I guess.
Um, not used to that. I didn't even realize I was logged in. Oh, yeah. No worries.
Just remember to add a load balancer and you're good.
Oh, for your design. System design.
Yeah.
Yeah. I heard someone complaining that AI was good at system design after training on a leak code for system design sites.
Um yeah, where are the There's hello interviews a big one man somebody must know in this chat the system design people um what did people used to use man I can't remember this YouTuber's name man it's like here's a googler and he had like a funny username or something on YouTube. Anyways, one dang. I got to check it out on the daily challenge. You say I like because 137 miles per hour. That's crazy.
Bite bite go. Uh no, but I think I've heard bite bite go as well.
man. You YouTuber system Googler.
I don't remember, man.
No. None of those. Jordan has no life.
That's the answer, man. Jordan has no life. I don't know if he's still relevant or if he still does system design uh stuff contents, but uh he's a Googler who does system design stuff and I've heard it's pretty good, but I've never actually studied system design, so I can't tell you.
All right, before talking all that nonsense, I was going to say, let me try and solve this Q4. So, let me read it. It's quite long.
I haven't solved it yet. I have no submission attempts. So, let's see.
You are the owner of a company that creates alloys using various types of metals. There are n different types of metals available, and you have access to K machines that can be used to create alloys. Each machine requires a specific amount of each metal type to create an alloy.
For the E machine to create an alloy, it needs composition J units of metal type J.
Initially you have stock I units of metal type I and purchasing one unit of metal type I cost cost I coins given integers n K budget and one indexed 2D array composition and one indexed arrays stock and cost.
Your goal is to maximize the number of alloys the company can create while staying within budget of budget coins.
All alloys must be created within the same machine.
Return the maximum number of alloys that the company can create.
Um, all right. I don't know how to do this.
I don't really know. But it's saying um there's a cost and there's a finite amount of metals.
Um is this just take it or leave it on crack?
Is this knapsack?
I'm not sure, man.
Let's look at some examples.
So N is what's N different types of metals. So three metals. What's K?
K machines.
K machines.
This problem is lots of pieces.
Um, a Heepa 1290 from YouTube. What's happening?
Heepa likes Grinder and DP. Everybody knows that maximum number of alloys that the company can make.
So the composition is what is this many units of I of the column.
Dang. Let me I don't know if I can do this problem in 10 minutes or however long I have before I leave.
Um Oh jeez.
So this is alloy one, two, three and um stocks I of metal type I for the e machine. I see. Oh, so the different machines I see the the two different machines are making two different types of alloys.
Okay.
So, machine one, machine zero and one.
Um, so which alloys should we be making?
Basically, I could probably do this problem, man.
Uh, but it's a lot. It feels like a lot. You got this mixer mechanical engineer. What you talking about, man?
Two projects is more practical. I find system design resources to theory.
Well, I think system design is a very specific dance that you have to do if you want like a big tech job.
Um, there's like a standard system design round where you do the dance and you say all the things that every other system design round says and you're in basically.
Um, so I don't think like doing projects will definitely be beneficial, but if you want to pass a system design round, you got to play and do the dance that they're expecting you to do, you know?
And there are some things in system design that you will almost like never touch in a personal project or something.
uh would be relatively straightforward napsac problem without the stock variable.
Yeah. Well, um the stock variable is basically unbounded knapsack versus bounded knapsack, I think. But we'll see. Yeah. Personal project may not cover the scale you have to know for system design. Yeah. because they they ask you like oh build a system that will serve the whole world or you know what type of system would you need to design for this scale and the scale is never like your social network your your scale is always like a billion people or hundreds of millions you know um a RAM edits. What's happening? Good morning to you, man. How you doing?
All right. So if I don't think I will uh code this up, but if I were to attempt this problem, I think um I think it's just napsac where but how do you decide All right. I'm trying to figure out what the states and stuff would be. So, we have a budget, we have a cost, we have the stock.
Ah, but look at this. Stock 000.
How you going to make anything if they don't have any stock, man?
How you going to get two if you got zero stock?
Oh, I see.
Um, if you don't have any stock, you got to buy and that's where the cost comes into play. I see. No.
Um, so I wonder if All right. If we were to do NAPSAC, how how would it keep going? Do we just keep like going forever? At some point, it has to stop.
Usually NAPSAC, I guess it ends when you go out of bounds, but there is no out of bounds here. It's basically you have the choice to make.
Oh wait, it is knapsack. The eyes are the composition that each row is like your knapsack eye.
And basically just keep making the current uh machine or whatever the current uh alloy type for machine one and you just keep trying to make that or you skip it and go to the next one. I think I could solve this problem.
I'm going to add it to a list, a new list. I'm going to call it 2026.
Uh, interesting.
I don't have time to do it, but each machine is like the stone in the knapsack.
And then, yeah, this is this is the knapsack.
Anyways, NYT connections. What?
The whole world. Wait, what are you talking about? The whole world.
Who's talking about?
Um, who's talking about the whole what was I saying? Like the whole world scale something. We got to do that before you go. Wait, do what? Le Whale connections.
All right.
Should I open that, man? You giving me some bunkass links?
I'll do it. Le Whale.
Um, the only way it changes from spamming your cheapest alloy is with a stock of metals.
Wait, so the way the way um, Knapsack, if you just keep trying the same one, it's not really. I guess you have at every machine you have two choices if you're doing it recursively like NAPSAC. The first choice is I will make I will make an alloy on this machine and then recursively call the function to repeat the same decision on the same machine that I'm on right now.
The second choice you can do is decide to go to the next machine.
So basically you'll end up trying like all um like permutations of machines you know like zero on machine one on machine one two on machine one three four five six until you can't anymore and at every stage you can do like zero on machine one and six on machine two or whatever you know like that's how it would work but anyways elite whale wants me to do connections.
I'm going to do it real quick.
All right. No spoilers and then after this I go groups of four oyster bubble tea.
Man, what the hell is this man? What is that? Sakis sakes Blair I don't even know what these words are man trumpet trumpet por bellow is trumpet a mushroom this is a mushroom this one's too hard man sound wisdom tooth wisdom bubble tea button mushroom is a button mushroom, I think.
Um, Alexa, swine.
Wait, let me let me shuffle them.
This is too hard.
Icon Blair. I don't even know what Blair means.
This one is way too hard for me.
All right. Oyster mushroom. I think that's a mushroom.
Which other one was a mushroom? A button mushroom. Porzello.
Um I don't know, man. Sometimes they do those to throw you off. All right.
Meadow wisdom.
Bubble tea.
What goes with bubble tea? Sakis.
No.
Alexa. Blair.
Herold.
Those sound like names.
Hey, Leeway. Why you trying to make me do these hard ones, man?
I don't see any connection anywhere.
Um, icon.
I give up. It's too hard.
Um, this is the hardest one I've ever done in my whole life.
Meadow is a mushroom. I didn't know that. Should we try those? All right. Q if I'm wrong here.
I don't know what I'm going to do. Is a button a mushroom type?
I think so.
All right. Q. This is on you, man.
If Wait, not button. Hey, you already said.
All right.
Swine sound. These are S's. What is a swine?
Um, can we guess? Wait, what do you mean guess?
I'm pretty sure. Yeah, I thought a button is a mushroom, too. All right, I'm just going to click it because I got to go, man.
Oyster button. Portortoello.
Which meadow? All right, here we go.
It's wrong. Q. I don't think that's right.
Wait, but it says it didn't do anything.
Mistakes remaining. Three.
Wait. button, link, icon, and what?
And menu.
That's crazy.
That's crazy.
Um, all right.
Trumpet Swine, bubble tea, things that uh yo, things that are overpriced.
Sakis, bubble tea.
I know the answers. Yeah, don't tell me.
Don't tell me.
Uh maybe sound and Oh, sound advice.
That sounds it's No, I don't know about that, man. Alexa Blair, are we allowed to guess more? No, I don't got anything, man.
I don't got anything. Panda poops. Also, what's happening?
Swine oyster bubble tea. What is that connection, man? Um, things that you eat in a restaurant or something.
Blair. Oh, like blaring trumpet sound.
Her I don't even know what herald is except in that Christmas song.
Hark the Herald, angel sing, glory to the newborn king. Something like that.
All right, let's try that, man. What Elite Whale said.
Uh Blair Trumpet, I can I can get behind this one.
Dang, you're good.
This is too hard. Like, all right, there's only eight left and I still don't know what the hell it is.
Like, what could it be?
Alexa, bubble tea, I think these oysters and portortoellos are there to mess you up, man. But I can't prove it wisdom meadow.
This is all right. I give up, man. Who wants to guess? Lee Whale, what do you think?
Alexa, wisdom six.
L Man, that's crazy. How the hell am I supposed to know that, man?
Starting with alcoholic beverages.
Then what the hell is this last group associated with pearls?
Hey, it it flashed it and it went away.
It doesn't even tell me again, man.
Uh, pearls of wisdom.
There are four mushrooms. Yeah. Oysters.
Pearls. Pearls. What? What were the other words? Either way, pearls in a boba. Come on, man. Nobody calls them pearls.
Do people call them pearls? I've heard some people call them b pearls.
Alexa, go with Yeah. Al a l e.
Anyways, that was fun, but it's time to get out of here. So, see you later, everybody.
Let's go raid somebody.
Anybody?
I don't know. But um who should I raid?
Let's find somebody real quick and then I'm out of here.
Dang pages small today, man. Nobody streams anymore.
Uh, Tibu Coder, thank you very much for the follow.
Nobody streams anymore. You guys want to watch Cloud Code?
I don't feel like raiding anybody to be honest. I don't feel comfortable raiding people these days cuz I don't know anybody anymore, man. anybody who's online.
Um, I can't just end though.
Can't just end.
All right, we're going to hit one of these people.
This guy teaching us All right. Anybody have recommendations here before I just randomly choose somebody?
Um, Le Code rock salmon shocked. Hey, Lee Code rocks me every day, man. It's crazy.
Who you want me to raid, Stephen? Who's that, man? I got to check who that is.
Uh where where you see that person, man.
All right, here we go. This who you want me to raid drugs.
All right, Steven Sagetball is leading the raid. Raid director, here we go.
Anyways, uh Oh, dang. I probably have to leave that open.
All right, everybody. Thank you very much for tuning in. Um I'll be back on Wednesday. X Proof, what's happening?
Uh how come you're doing le code? have it's like the one thing I've always done since I started streaming 5 years ago.
That fraction problem I think you could have done pretty quickly. Uh I think I know the problem. I think it's like a DFS or something, but I just don't like fractions. Anyways, Pixel Pusher, Adios, Amigo, Q Ultima, Steven Sagall, see you later alligators.
Uh no, don't be saying nothing like that, man.
Uh, X Proof, see you later. Panda Poops, thank you very much for tuning in. I'll see you guys next time. Wednesday night.
Uh, Rusty Hots, thank you very much.
Adios, amigo. Everybody from YouTube.
Uh, Ram Edits and Heepa and, uh, everybody else from YouTube. Have a good night. Thank you very much for tuning in. Brian Hernandez, uh, Solo Sword. See you later. Goodbye everybody. I'm going to go play Pal World. I'm not going to lie.
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

Ben Crump dealt MAJOR BLOW after His Own Nolan Wells Autopsy FACT CHECKS him
DeVoryDarkins
50K views•2026-07-23

Gremlin Arrives… While Dorothy May Takes Another Step Forward
The-moons
10K views•2026-07-23

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

Daystar: The Great Grift & Prostituting the Gospel
LauraLynnThompson
14K views•2026-07-23