In a complete binary tree, a node is called 'dominant' if its value equals the maximum value among all nodes in its subtree. To solve this problem, use Depth First Search (DFS) to traverse the tree: for each node, recursively find the maximum value in its left and right subtrees, then compare this maximum with the node's own value. If they match, the node is dominant. The algorithm returns the maximum value from each subtree and increments a counter when the dominant condition is satisfied.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Weekly contest 511 | Live Attempt
Added:Bro, good morning, bro.
Good morning.
Let's go.
Corner starts in 30 seconds.
Let's go, bro.
Let's go. Let's go. Yo. Yo, what's up?
Good luck.
Good luck, bro.
Share screen. Yes, sir.
Okay. Good morning, brother. Morning.
Let's go.
Good luck to everybody.
That's right.
Starting down.
What the [ __ ] bro? I've never played chess.
Even number of moves.
Four six done and falls.
Four.
8 0 1 2 0 1 3 4 5 6 6 How do you do this?
1 2 1 32 Bring two. Say four.
[ __ ] How do we solve this?
D2.
So a knight moves like knight can only do this.
+ 2 + one. All right.
+ 2 -1 - 2 + one - 2 - one. Right? These are all the four options.
So 1 1 0 + 2 + 3 - 1 + 1 + 2 + 1 - 1 + 2 -1 - 2 uh 3 2 4 How 3 2 4 That's + one + 2 + 2 - 1 2 Can knight move everywhere? So up four, five, 66 difference is basically uh uh 2 and 1.
Three and two.
Bro, I have no [ __ ] clue how to solve this. I've never played chess. Is it the Manhattan distance? should be the man atom distance should be what I think it has to do something with the man it And here the distance is two. And in here if we see one two if distance and one return false return true bro is it this like I don't even know how do I check true and false how do I how do I check bro how the [ __ ] do I Check 2.5 people have done it.
I can't even. [ __ ] it. I'm going to submit.
Oh my god. Thank you, God.
You're given a the root in a complete binary tree. A node X is called dominant if its value is equal to the maximum value among all nodes in the sub tree rooted at X.
Okay. Then the maximum I'm complete binary tree.
Yeah. So this is basically okay. A tree question after so long, bro. Tree question after so long.
after so so long in solver that's going to take in your tree node star node C node. Okay.
Now what it does is uh if C node left equals to null and C node right equals to null.
You just need to see.
Uh board.
53 is my water all are dominant. 2 47 are dominant.
Oh, I've not done three question in years. Holy [ __ ] How name do we have 10 to 5 done uh well I'm trying to figure out do we memorize the trees are just BFS or BFS and you don't memorize DFS BFS you don't memorize >> [snorts] >> unorded map star, uh, Stupid.
Shut up.
Where do you [ __ ] stop this alarm, bro? Hug.
S and uh take question we we don't have to memorize This is what What you do is max left is solver.
Oh oh oh oh oh oh oh oh oh oh oh oh oh oh oh oh oh oh oh oh oh answer plus it just return the number if c left not equals to null. Uh and min right max equals to end min.
Uh you can say left max equals to uh max here for c node.
Why do I have this [ __ ] in here?
Max here no right and then you can say in answer equals to max between uh left max uh you can say c node value comma max between left max right max uh and then just say hash of C node equals to answer return answer this just tells us the bro how do we solve this trees question I've not done them in like 100 years now you run a DFS and for every node you run a max here is that how you do and now I don't know if this will work.
end start max root equals to max here uh hash of c equals to how to Make a hash ordered map for three node three node star right. Yeah yes yes yes.
C not equals to c not yes. Max here of root. Now the answer equals to zero for auto ID of your hash.
Oh wait, wait, wait, wait, wait.
equals to int C value equals to C node value. Okay.
Max value equals to max between C vala max between left max comma right max.
If Maxwell equals equals to C val you can hash of C node equals to C node.
If maxwell else if what if is called dominant if it value is equal to the maximum value among all nodes.
Max, man. Bro, I'm [ __ ] already equals to Okay. C node left.
This is right max of uh return return.
You need to return actually.
Wait, what am I even returning?
I'm returning the max value.
Okay, I'm just returning the max value.
Yes, theta H.
Well, this question is so easy. But just because I'm I haven't done previous question in 30 years. 4.6 [ __ ] K.
What?
What's the error?
Oh, where is it?
What solution count do error to make column clean?
What the what is this saying?
What is this? Uh default construction is implicitly because this field hash or reference type would not be initialized.
The [ __ ] is this guy saying? Bro, what if Okay. And you just make it a map here.
Oh.
Okay. Five. Five.
Four. Four.
Would it actually work though?
I don't know.
Uh, not doing not doing trees question in 10 years and I still solved it in my first attempt. Bro, this is what we call I don't know creating the mindset to solve problem because I really hadn't solved T's question in thousand years.
You're also given a binary string.
Hold on. also given a binary string and given an array of string strin or array where e has the same length and s consist of characters 01 and can be replaced by the you may perform the following operation. Choose any subsequence sort subsequence in nondereasing order.
Replace [clears throat] the chosen subsequence in S with the sorted subsequence keeping all characters un names.
Then return a boolean array where answer I is true. If it's possible to replace all with zero or one and transform is what the [ __ ] Oh my god, bro.
where answer is true constraints it's just 2,000.
Okay.
If it's possible to replace all question mark in that with zero or one and transform into the resulting string using the allowed operation above.
transform S into the resulting string which is the operation of strings is replacement you can do it individually 101 matches 011 okay and then we can rearrange it The one match 011 sort 101 to get 011 subsequence.
You're also given a sort replace the chosen subsequence nest with sorted subsequence keeping all other characters unchanged. Okay.
[ __ ] So, there's just too much things happening in this question, bro. Too many things happening in this question.
But honestly, yeah, DFS. Yes, sir. We did using that.
Uh, you're given a binding. What is my rank? 6K.
Five. 5K.
[ __ ] [ __ ] bro.
Okay.
So, the first thing is 1 1 0 1, bro. This [ __ ] is so one one false.
Uh 0 0 0 or 0 1 0 1 0 1 0 0 1 1.
Wait. So is it false in every [ __ ] case wherein the characters don't match?
Okay. False 1 0 1 0.
Select the subsequent 02 of index s.
Okay. So the point is a you can do that anytime.
Okay. In fact, just look at these operations as replacing 0 and one.
Yes, sequence that is all.
Let's see. 1 1 0 0 1 1 0 is your string.
1 1 0 1 false 1 0 1 1 0 1 1 0 1 0 1 then it would be okay. So I think the logic to say key it can match is only checking if the intended one versus intended one position is always greater than or equals to current one I think so one moveh I feel like yes if this is your target and this is your current So you can say current uh one index of current should always be less than equals to one index of target.
Take to this and this works.
No, you can. 0 1 0 1 0 1 P wait.
So basically our operation is we can swap any zero with one and yes we can swap zeros and one. That is the operation.
Swap zeros and ones. Uh [ __ ] Hold on.
Hold on. This is a target one and target two. Target one and target two.
Uh uh uh. Is the point I'm trying to make is if string 0 0 1 1 we cannot do any [ __ ] If a string is already sorted that basically means your string is already sorted.
If it is not wait uh no so I need to figure out a few cases. What what was the 1 1 0 0 1 1 0 0 1 0 1 0 0 1 1 and 0 1 0 1 and basically swap 1.
Yeah.
Swap say fair in uh uh uh SK or SK swap. See, bro, just look at the big picture. It doesn't [ __ ] matter. Look at the big picture.
Uh rather than doing this, what you would want is replacement.
replacement second should also be I mean it depends one key so you have to fill in left side with zero first 0 second I'm just seeing possible conversion replacement logic is clean now it's just about uh conversion possible let's say Yeah.
Uh we have 0 0 and 1 one I think is it never False.
I can't figure out a false case, bro. I guess I need to do a wrong wrong answer submission and then just get to know 1101.
False case is false 0 1 0.
So false case I guess is just when your frequency don't match or false case or if your S is already sorted you can't do anything 0 0 1 One one can swap zero and one.
You can swap zero with one.
zero.
Hold on.
Oh, wait. This [ __ ] can never be built until and unless zero. Okay bro, come on. Okay, if you look at it, the observation is zero left.
That's all.
That is all you can do [cough and clears throat] from your original string left shift wherever there is a one.
Okay.
Mhm.
Okay. So, we figured it out. We figured it out. We figured it out.
Uh at least zero and everything's frequency should matching. Okay, I think the logic is fine. Now, we might just have this question solved.
uh int matcher dual matcher sorry which takes in your ve uh string s string t. Now what is the length of your 2,00 and N. Where is N?
RC C of your Z C [cough] [laughter] and I = to S. than -1 I is greater than equals to 0 I - 0 in S 0 in T = 0 logic T. So if first of all if s 0 if s i equals = to zero to 0 in s+ if if t i equals to equals to z in t + if any case 0 in t is greater than 0 in sce source. So then you return to take. So the matching logic should be I think so this is just the entire logic.
Now what you do is replacement me you always put target me the left most you have to match the frequency or left most no I think we solved it that's all.
That's all. Uh first you have to do the replacement.
Uh int zero frequency = to 0.
So one frequency equals to 0 for car C of your S. If C = to 0 frequency + L1 frequency plus. Now what you do is for string s of your strs in current 0 frequency equals to 0.
Current one frequency equals to current one frequency equals to zero. Uh now what you do is for car C of your S if the C equals not S str if C= to0 then current 0 frequency ++ current one frequency class [cough] fill in. So what you do is now string temp equals to str.
What you do is for car again car C of your STR if C equals equals to question mark and uh C 0 frequency is greater than zero zero frequency But uh uh uh uh not your SDR temp frequency is less than zero frequency cannot be equal.
H do cannot be fair [snorts] [cough] bro I'm doing current zero frequency less than zero frequency trade shouldn't be too much shouldn't Too much. How many people will solve this? 4K people already must have solved this 1,000. Not much, bro.
Current zero frequency is less than zero frequency to get temp I = to uh zero.
Else temp I = 1. Right.
extra zeros.
Just apply a check here, bro.
I think this should be fine.
If what was the case, bro?
[laughter] Vector ba.
Vector bool. Answer.
There are case. If uh CZF F is greater than CF or C1 F is greater than uh C1 CO I mean zero frequency one frequency C1 F is greater than one frequency then you return uh then you do instead Push answer push back answer push back false continue. Okay.
Continue.
Correct. Correct. Correct.
Correct.
Equal he.
Now you just have to do bool check equals to uh matcher matcher between your uh uh uh uh s comma m if check in fact just do a r answer it is a r sorry error error dot push Push push back your check. That's all.
That's all. Return error.
At least let it compile.
Where's the issue?
ZF ZF uh one frequency. Yes.
Temp of I Oh my god, bro. and I = to0 I less than temp dot length [laughter] I ++ and you just say car C equals to tempo file true true false so true true false that is working true false true is working and true is working.
Should I submit it? I think yes.
Yo, bro. I think this should work.
True. True. False. True. I actually don't care. Let me just submit it.
[screaming] True and false.
How the [ __ ] did my matcher return here?
My matcher should have returned a [ __ ] Yo, this is a Wait, how does this make sense? How does this make sense? My matcher should have returned false here, bro.
see out s.
How does this make sense? This is unexpected.
Uh S is 01 to go 111 Q.
Wait. So my this logic is incorrect. A I'm not handling in here probably.
Oh my [ __ ] dumbass.
Bro, I didn't [ __ ] [clears throat] correct now. True, true, false.
Wait, hold on.
True, true, false, true, false, true, [clears throat] true.
And your fourth one false, which is it is correct. And we don't want to see out any of this. Submit this.
Good day.
>> Good day, bro. In fact, I could have solved it in my first [ __ ] attempt. I did a very stupid mistake. There was no error in my logic. No error in my logic, bro. Good day, bro. Good day. We like days like these. We like days like these, bro.
What about you, Y? It's tough.
Is it? Is it tough, bro? We just did it, bro. Are you guys talking about the fourth question already?
Again, I'm giving up lead code. I'm not made for this [ __ ] I hate this [ __ ] lead code, brother.
Brother, there might be some ups and downs, but we can't quit lead code, bro. God has put us on this earth for a reason, and that reason is to grind lead code. Let me be honest with you. The only reason we exist on this planet is to grind lead code. We can't quit, bro. We can't quit.
We can't quit, bro. The only reason for our existence is to grind lead code.
Let me be honest with you. You shall not quit. Approach Katy third sa I can't tell during a life contest brother. What are you talking about? I can't tell during a life contest.
[ __ ] man. This is what we like, bro. 2K rank after what? Thousand years.
This is what we like. And I could have avoided that penalty. I am stupid, man. [ __ ] bro. This is what we like, bro. Is Is this a lead could be smooth time? Nah, that's too much. That's only for all kills.
They find a transformation.
What's all dudes after solving third lama giving life motivation and [ __ ] bro? Bro, no it doesn't. Listen, listen, bro.
Brain humor 9121. I You can literally see I've lost my night badge, bro. I actually don't care if it's a rating gain or loss, bro. But we got to keep grinding lead gold. That is something that's persistence in your persistent in your life. Doesn't matter if you're gaining rating or not. Praan exactly given an array of string. Do we define a transformation on the string s as follows at even uh independently cycly shift e and zero by any number of positions to right possibly zero to right reconstruct string by two strings are equivalent if one can be transformed into another by a single transformation. Partition words into minimum number of groups such that if one trans can be partition words into minimum 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. [ __ ] What are you talking bro? What are you talking [cough] Z and G?
Okay. Therefore, both strings are equivalent and belong to same group.
Okay. A, B, C, C, A, and B. What is the length here? It's [ __ ] 10 to 5, brother. 10 to 5.
I think what we can do is sorting odd indices even indices if they are equal.
No, it doesn't make s To find the cycle there was a very beautiful way words.length length the sum of words I do not exceed chat even this might be a bit too much bro there might be at least did he do third [laughter] you guys don't believe I can solve third or what the [ __ ] do you mean bro why do you keep a mustache I don't like do you think this is a mustache I did third bro hello hello brother I'm beginner and need code currently solving uh solving problem every day but before going to graph df FS and BFS I have to learn recursion but memory but K4 away bro recursion is literally the most intuitive concept ever bro I mean if you learn recursion bro you you're going to unlock so many things in lead code if you learn recursion recursion recursion is so important brother grind your ass you need to learn it ntj is ng zw W and G NG Z or Z NG matches group.
The point is [snorts] how do you so the question translates into strings and you need to see if they are a rotation of another string.
A B C D A B C D Now B C D A is a rotation left right independently cycle shift E and zero by any number of positions to the right. Oh to the right.
Huh? B C D A B C uh D A Huh to the right. Okay. So, O of N. O of N. Bro, this [ __ ] might be But we'll get a [ __ ] D if I do that way.
Words length 10 to 5 [clears throat] 10 to 5 into 10. Nah, bro.
How the hell do I How the hell do I get rid of a T here?
What the [ __ ] They have given such big constraints, bro.
How do I get rid of TL here?
10 to five. What?
We can't be constructing the substrings.
Let's say if we had A B C D E is sorting a method to check A B C D E F and B or E merge E or B or C D A F. See now this is you can try rotating it as many times as you want but it would never work.
Sort sorting is not a reliable method.
Sorting is not a reliable method. There there used to used to be a way check if string is check if string is rotation of another delete code. There was a question like this. Rotate string.
There was a question like this already, bro. I've done [ __ ] brute force here.
I've literally Oh my god, bro. If I would have done a good uh approach here, I would have reused my approach. But now looking at my code in here, bro, chat, look at how I have solved this this question. This is useless. I've literally [ __ ] erased characters and added it to the front.
Stupid.
So, this code will not help me. I wanted to see if I had some logic to check rotations. It's all about checking rotations.
How the [clears throat] [ __ ] do we find rotations? L explain the third approach after the contest ends. Brother, you can still solve it. You just need to figure out some observations. It's all about finding out observations. There's no coding involved.
Why? Third prefix for S and suffix for S. String. I didn't use that.
Third was actually a nice question. Had fun solving it. See, this is how Yo Kavish, where have you been, but this is how people like to flex like he won't just directly say I solve third. Look at how he's framing it. Third was a nice question. Had fun solving it, brother.
We know you solve third.
hashing guys.
I don't know. I got gray by third. You can't solve it, bro.
I'm just trying to I'm I'm angry about my penalty on third, bro. I didn't deserve that penalty. I just wrote a if conditional if condition.
Never mind, bro. In here the sum of words i length do not exceed sum of words i.tlength.
Oh, hold on.
Aa the sum of words i.length.
Oh. Oh.
[ __ ] This is stupid. sum 5 into 10. So we can follow our approach. The question becomes optimally check if a string is a rotation of another. If a string is a rotation of another, how the [ __ ] do I check that?
How do we check that? Oh, how do we check that if a string is a rotation of another?
C D E F Bro I don't know how do we check this Okay. I think ABCD. What we can do is we can shift that by right. Right. Yes. A B C D here.
What if we had D C B A?
So D A B C.
So that is incorrect, bro. That's incorrect.
That is incorrect.
[ __ ] bro.
[ __ ] Bro, I just need to figure out an optimal way to check if strings are rotation of each other, bro.
Damn it.
What is it? Make a function for rotation. Yeah.
Come on, bros.
Brah, hold on.
Any advice for 2020 year old unemployed depressed CSgrad? Brother, life is too big. You don't have to be depressed about it. Let me be honest. Life is too big. You don't have to be depressed about it.
We can't Why can't I think of it? I feel like I did read about it. Optimal way to check if strings are rotation. We can't just [ __ ] BCBA.
>> [cough] >> Yellow A.
But still A B C D right shift D A B C uh C start D A B C You can start at any index.
You can start at any index. And bro, if I knew this, I could I think I can solve this. But how?
How, brother? How? How?
Social media, bro.
What the [ __ ] are these news? What the [ __ ] are these videos?
That basically means dab.
I might just be cooked, bro.
Cycling shift while someone I will suggest make a new chat and give GP a prom to prepare for. Yeah, bro. Yeah. All right, gang. Am I out? S equals to S + S is the hint, bro. You solve the fourth question, bro. Got mocked yesterday. Shut up, bro. Shut up.
I didn't get mogged, did I? I don't even remember.
I don't even remember.
Feeling like a left, bro.
D C B A. Now try to find ABCD in there.
You can't because there exists none.
There exists none.
So the question translate into find a substring if it did not match. You'll have to [ __ ] A B C A A A A A A A A A A A A A A A A A A A A A A A A D A A A A A A A A A A A A A A A A A A A A A?
Can you do that again?
How do you still do it, bro? This question is crazy. I'm still getting I'm What is your rank? 2.8K, 8k maybe minus 2.9 I am literally 3,000 bro kavish bro did you get a penalty I got one penalty and that is what [ __ ] [ __ ] me up bro [cough and clears throat] solve the question first the [ __ ] you mean bro I'm trying I'm trying I can't let me turn off the trying bro. We can't ad ba.
So the question now translate into find string find if your current string has this substring. Okay which find substring in string in CPP do you have any inbuilt method?
Hold on.
Wait. So there is an inbuilt method.
Find target string and pause.
I think let's just use that inbuilt function, bro. Let's use this inbuilt function.
I I don't know. Let me at least try coding something.
Bool is cyclic that takes in your string s and string string substring up to string s uh what what is this size t dot found size t Found this is basically s.tfind s.find substring right that is that is text.pfind point. Yes.
If found is not equals to uh str boss return false return true return false. Okay.
Okay. This just checks cyclic. Now for birds.
Wait, the point is you also have to turn it far.
Every pair of strings in the same group are equivalent. Return an integer denoting the min number of Okay.
Want to be your vacuum cleaner.
Brea in your dirt if you like.
Hold on.
Every group should be identified by its string or every string.
Okay. Okay.
Okay.
vector of vector of int that is vector of vector of actually string.
Uh uh uh uh uh uh uh uh error and hash of odd substring unording.
So that you don't have to calculate [ __ ] again and again.
Even substring even substring. Okay.
Okay.
Calculate and store substring uh uh string find.
We don't want any over uh Doro should be cyclic, right? Yes, doro should be cyclic. B vector of string.
Find substring. It's going to return return odd substring and even substring string odd substring even substring for i = to bro take a [ __ ] string and input string and s i = to0 i less than s.length length I ++ if I and one odd sub string plus equals to S of I else uh S of I in the end you return your odd substring even substring.
This does not we actually don't need their child. We actually need a vector of string.
Error dot push error dot push back uh uh uh uh error dot push back words zero uh vector of string auto temp equals to uh find bro at least don't do typos find bro this is going to give a t this is Not that easy.
Words zero.
Now you can say odd substring of words 0 equals to temp 0 and temp 1.
Yes.
for end I = to 1 I'm typing query now print I= to 1 I less than your words dot length I ++ [clears throat] I ++ if uh uh Check existing uh words say check or string s of error.
Take care.
This checks equivalent.
[ __ ] It takes in your two strings, right?
String and S1, string and S_sub_2 strings key or even substring odd or even substring and even subring What the [ __ ] Hold on. Am I complicating it? How many people sold it? 1.5K.
2K.
Aa the question was check current key OSS is rotation of target key oss.
Same for current ESS. Target ESS.
If yes then good.
If no then scroll ++ after checking for all. Click here current and target. In fact, yes current and target plus equals to tar dot find is cyclic.
Find substring returns even substring odd substring and equivalent.
Find ESS OSS of S1 and S2 and then check cyclicity. Then check cyclicity.
I think hashing hashing function.
That makes your code so much cleaner.
Function substring may give us two unordered maps.
that does the hashing for us.
If sub of s comma even sub of s in the end you can say r sub of s equals to oss is even sub= to ESS.
Yes. Hashing if hash.find s1 is not equals to hash.
Then you can say string s1 oss sub s2 oss s1 ess1 oss s1 oss equals to uh not odd sub equals to odd sub of your S1.
S1 ESS equals to even sub of your S2.
Yes.
Find find sub for your S1 S1, [ __ ] I let Let me just declare them globally, bro.
Let me just declare them globally here.
Find subring s_ub_2 s1 oss equals to s1 sub key z just kill me bro. What the [ __ ] bro?
What am I doing? Just the b in 15 minutes.
Kish, you did fourth, bro.
Kavish, you did fourth.
Yeah, you you get stuck if you think a lot.
Kish, brother, you did fourth. Boris, bro. If you have played chess before, you know that a knight can move from one cell to another with correct moves. I didn't know that, bro. So, Mr. Minoxidil third stream of this week. Yes, sir.
Bro. Yes, sir. First of all, stop calling me Mr. Minoxidil, bro. What do you mean, Ravish? Bro, you did fourth, bro. I'm jealous.
ESS equals to this.
Hell no, bro.
Bro, bro, did an all kill. That's insane.
S1 ESS is S1 sub key zero. S2 ESS is S S1 OSS is always zero and S1 ESS is S1 sub 1. S2 ESS is S_UB_2 sub 1 up. Now b check one equals to is cyclic is cyclic current and target s1 oss, s2 oss.
If is not check one return false check two equals to is cyclic S1 ESS S2 ESS return check one and check two and and check one true.
Okay.
For string s in er r match false.
If pool equals to eq ui eq ui your string and your your [ __ ] words i.
If is same then you can say matched equals to true and break.
If matched true.
So then you continue match true.
What you dot word of I words of I sorry and in the end return error dot size no target plus equals to t what undeclared identifier str. Did you mean std?
How do we use how do we use this not equals to n std st?
Oh, string. Sorry, sorry, sorry.
It's actually string right. What is the name space? The name space is string.
It's called namespace, right?
Is not equals to words. Len.
Oh, chill.
is a so many compilation errors, bro.
I I write so bad code, bro.
1 3 5 Let's just submit it. We're going to get a TLE. I know. Let's just submit it.
We're going to get a TLE.
because it IS VERY UNOPTIMIZED.
[screaming] Shut up. I know that. Shut up. Wrong answer.
Wrong [ __ ] answer.
Yo or yo.
Output is four. Expected five. So, hold on. I didn't get a TLE. I got a wrong answer. What?
>> [clears throat] >> See how matched s there are uh words I match.
No, it matched. Why are you go? Are you [ __ ] stupid?
If S1 not equals to S2 length turn false.
What?
Oh, easily climbing.
Hold on, bro.
We're just five and we're not matching anything.
Let's get Let give me my TLE, bro. Give me my TLE.
[screaming] [ __ ] knew it, bro. 692.
6, bro. 692 by Oh my [ __ ] god. One test case away. One test case away. Is there anything I can do to optimize this, bro?
Any [ __ ] thing I can do to optimize this?
Oh my god, bro.
[ __ ] [ __ ] bro. Anything I can do to optimize this?
No, brother.
Anything. Just any [ __ ] Please tell them. Please tell them I [ __ ] hard. You dumb asses at lead code. You don't show test cases, bro.
These [ __ ] Oh my [ __ ] I can't see any way to optimize this, bro.
Equivalent maybe early return.
I'm checking if that word is same to any of the same [ __ ] bro. So, you're telling me I'm getting What the hell, bro? First question, bro. It's just Manhattan distance, bro. You only said why hide solutions. What the [ __ ] are you talking about, bro?
N to five solution.
Bro, you're becoming Mikuel Tal from MB.
Save your Who the hell is Mikuel Tal?
Bro, what the [ __ ] is this hairline, bro?
Damn, look at where what his hair were one time began to succeed in this happy birthday.
Where is he? Is he in? No, but he's But he's a genius, bro. He's a genius. Latian Soviet chess grandmaster.
Bro, I'm getting [ __ ] off. And I do not look like him.
What are you talking about? I wish I was as smart as him. And he doesn't look bad. It's just that his hair is bro was getting distracted from there and might just get all killed. Bro, I can't see any way to optimize this optimize.
[ __ ] one single test caseimize.
Huh?
Break early.
[ __ ] I don't know how to optimize this.
There's just no scope for optimization.
I'm maybe there's another approach so that I can't change my entire approach.
I don't have any other approach. But optimization, no optimization, bro. 692 by 693. Wow. Wow.
Wow.
Wow.
current or target.
I don't know, bro.
Let me just submit it again.
>> [screaming] >> [ __ ] [ __ ] Bro, I think that's Wow. This is going to be one of 2.60 people sold it, bro.
One of the saddest contest, bro. 692 by 693.
[ __ ] Life is just so bad. What do I even say?
One single test case stopped me from getting my all kill. A single test case stopped me from getting my all kill.
Third is just handling zeros. Exactly.
What was the second question?
First was just Manhattan distance.
Third.
Okay. The third. Why did third? But after you said observation is important.
Yes. The third was just an observation based question. You just had to figure out a few observations. And then the first observation was false target string or source string 0 key or one key frequency match frequency match. to directly false.
Let's say target string which has which has some these question marks in there one frequency source string one frequency zero one frequency of target is greater than one frequency of source to false.
Similarly for zero frequency of target is greater than zero frequency of of source to be false.
What you have to do is frequent add left to the very zero one add possible depends on your zero frequency target. This was the logic for replacement. Besides that now how do you check if the string can be converted brother this choose any subsequence sort in this whatever whatever we don't care what it basically means is sort and it's only a binary string so that means zero can and one can be uh zero or one go up interchange And that also basically means your string at max left.
That's all you can do. That is your this entire [ __ ] This entire [ __ ] means left depends on how many you how many ones you have on its left.
So that was the logic bro matcher. This was the logic that just tells you zero in target greater than zero in what that means is if your target was let's say if your target was uh 0 1 0 0 okay and source was source was uh 0 0 0 1 source was 01atch it still remains 0 right at any moment t so you simply return False. You simply return false. This is assuming key. This comes after assuming not after assuming.
After checking key, S or T key, zero frequency or one frequency is same. This was the logic. Now, this was the logic.
Let me show you another working example.
Mano, if your S is 0 1 0 0 S target is target is uh 0 0 0 1 uh in fact this is also false. This is also false. Basically matchically you have to move here. But can you ever move that?
No. Because it's just binary.
Why would this return false?
So you return false. This was my logic.
Good or bad?
Question three is maintaining a prefix containing one's count up to a certain position. I just did I just maintained zero count bro good no same approach bro I got to this after many attempts it's crazy you thought this at first only nah brother this was an ob mean yeah come on okay brother the cheaters are I'm damn sure see it's an algo called boo algo and these guys just wasted why are you guys surprised bro you just have to get the sorting part rest is easy exactly exactly the replacement logic that zero frequency and one frequency match and If there's an option, always add zeros on the very left of your target source match. Zeros at the left is the optimal case. That's all. That's all bro. That's all. And another observation was subsequence and sorting and all that.
That simply means left. That's all. Read my two upper comments. What is upsolving in contest?
Where are upsolving? Basically means uh the questions you couldn't solve in contest, solving them after contest and learning learning the trick. Plans for today. I might be going out with my family for lunch. Uh besides that, I don't really have I'll go out for a run.
Yo, good good reminder, brother.
Whosoever that was, it's time to check track my.com. For those of you who don't know, this is a new project that we have built wherein we basically log in each and every day. Bro, if you if you don't document your grind, you're stupid. I am logging my each and every day in here.
Let's see if anybody else has started logging.
Okay. So, we have Pudish is me. Pudish is me. Adita BHD99 AB33.
And I told you that if you're logging here consistently, I would be reviewing your profiles. Let me show you first mine, right? So yes, and also the fact that right now I have added an option to add track your metrics like bed time or Instagram, but I feel like that is very hardcoded. I want users to give them their own metrics whatever they want to track, right? So we I'll be adding an option to add custom metrics so that people can add whatever metric they want to track their bedtime Instagram time or even their daily goon count whatever bro whatever. So yeah, I'll be changing that. Right now, I'm just track I've just hardcoded two metrics as bedtime and Instagram screen time. And if if I look at my week, oh, I've not logged in. I've not logged in, bro. But you can see my week has been pretty okay.
Eight out of 10. And my this is my entry for the day. Entry for the day. Let me just log in, right? Let me just log in.
Let me just [ __ ] log in.
Yeah, let's look at my month, bro. My month has been going pretty The last week has been pretty okay, bro.
It's It's a bit green. I even had a [ __ ] eight out of 10. And hold on.
Last week, I also cleared my probation.
So, it was a 6 out of 10 day, right?
Finally cleared my probation. Whatever.
Whatever. So, you get the gist of it.
Let's look at the other people who are tracking it, bro.
So, we got some guy named Sh. This is Shaitan. And also, if you don't want me to check your profile, just make it public. Just make it public.
More scroll one left. Don't Don't chase random [ __ ] in Metro, bro. Drops random [ __ ] What?
What? But what is my bro saying? Can I add all my time?
We can have a goon counter in it too.
Yeah, bro. I mean, if you I'll just add an option to add custom metrics. Now, if if it it's up to you if you want to track your goon count or not.
Can I add all my time starting 11 in there? No, it's just a daily short log.
It's not to write huge ass journals.
There's a text limit. There's a text limit. Let's see what Shatan has been [ __ ] doing. Bro, this guy slept at 3:50 a.m. Is he stupid? That's why he didn't give contest today, bro. 30 minutes Instagram screen time. That's not bad. But he slept at 3:50 a.m. Is he [ __ ] stupid? What time did I sleep last night, bro? I slept at I slept at 2:45. Bro, I'm not as bad as Shatan. Bro, on July 15th, I slept at 5:45 a.m. and I had office tomorrow. If you want to read why did I sleep so late, check out Track My Life, bro.
Track my life. Solve one DSA question.
Easy. Did some C programming one could hard problem and also wasted a lot of time. Congrats bro, you're wasting a lot of time. Congrats. So, this was Shatan Aditya, BHD99.
Let's look at my bros entries.
Today I saw three question of bi-weekly.
Congratulations. Also completed one section of e-commerce product.
Congratulations. Good day. Seven on 10.
Why I can't why I can save entry for future. Can there be an option where we can choose what habits we want to track in particular not just in bed by time?
Oh yeah. See, that's the same thing I'm talking about. BHD, bro. Sure. I'll keep that in mind. Hold on. What is this guy doing?
[ __ ] eight out of 10 day. B12 D2.
Dude, what the [ __ ] is this? This is some code language.
AJ 31003. Bro, I don't know, but I'm happy you had a good day.
This guy had a 1 hour 30 minutes of screen time. Okay, coming to AB33. Slept at 2:00 a.m. Let's look at daily log. 7 out of 10. Decent day. Tetness injection. What happened to you? Doctor said she will admit me if my sorasis flared again.
Soriasis. What is that?
It is acne.
Damn. Wow. I hope you you get well fine soon, bro.
Maintaining my CF lead question. Let's go. Early sleep because of morning contest. What time did he sleep? This [ __ ] slept at 2:00 a.m. and then calling it early sleep. Absolute [ __ ] liar. Absolute [ __ ] liar.
I was at 4. Nah, bro. I did not know.
That looked like multivitamins.
Might be, bro. Might be. Might be. Fab counter. Chill, bro. Chill. Show the code of third question. You want to see the code for third question? How do you speak so illquent English?
You think my English is iloquent?
I don't know, bro. Probably watched a lot of English content.
Bro, this is my code for third. Who?
Whoever was asking it, pause and look at it. Pause and look at it. This was my code for third.
Ro spent 40 minutes on first question, 30 minutes on another two.
Damn. First question was just Manhattan distance. Even I've never played chess, but Ethan first question should would always be easy. So, I just did the Manhattan distance. Bro, are you on Twitter? Yes, but I don't post anything, bro.
I've been watching you since last year and you've made a good progress in English as well as solving problems.
Rohan Gaming Tech1826. Thank you, brother. We appreciate them, bro.
Appreciate that. Thank you.
Bro, your lead code ID ID is Pist G. Pist G. I don't think first is easy. Yeah, it was not easy.
Minus 10. Hold on. I didn't see my rank, bro. I didn't see my rank.
3.7.
[ __ ] Let's check entrance.
This weekly is 511 with this G.
Finally, bro. A plus 16. Although I'm still not in 1800s, bro. I'm still not in 1800s.
8 minute. Why is it taking 4,000 rank?
I'm 3.7K.
So I might just be I might just get plus 17 plus 18. We're very close to back to 1,800. Bro, yes sir. Do you think we can get back a night badge, bro? Do you think we can?
How important is recursion? I'm stuck at it. There's no DSA without recursion, bro. First was easy to be honest. I spent time on recursion, but then done with Q. What?
Look at how I did first. What the [ __ ] are you guys doing, bro?
This is how I did first, bro.
This is how I did first. Why is it not?
Why is it not? It was just Manhattan distance. Manhattan distance to return false return true. I just saw this from the test cases.
Manhattan distance is even false. That's all, bro.
You guys are genius. First game made me to [ __ ] Nah, bro. It's nothing about being genius. Trust me, I'm dumb as [ __ ] Solve threesome now without going for solution. Oh my god.
I threesome. Damn. That that wording is crazy. Threesome. Wow.
Will I ever get a three?
Shut up, bro. Add the baddy chat time.
Battery chat time in in track my life.
Track my life. Track bro.
Start.
Uh. Yeah. Let me just spin it. Bro, explain. Third heist, bro. I've already explained it. I've already explained it, bro. I have already explained it.
Crack my life. Bin message. Bro, I'mma add a goon counter for this week. I need to add a boom counter for this week.
Hold on. Okay. Another another thing I wanted to tell you. This feature is not very visible. I'll increase the visibility is you can add weekly priorities besides your daily at this.
See, today marks the start of this new week, right? What do I want to [ __ ] achieve in this week? I add in the weekly priority. So now when for this entire week, that priority would be active. And now at the end uh every time I'm filling in a daily log, I'll have to answer how did your weekly priority go just so that you stay focused. So this week's priority I would say I want to learn sweep line sweep.
And what else should I learn? Golang, bro. In fact, just do Golang. A little bit of Golang. A little bit of Golang.
This is my this week's priority. Okay.
Golang. Now whenever I'm filling in whenever I'm filling in my daily entry you can see I need to add an update on Golang you're forced to write your progress and when you don't do anything you are forced to write I didn't do anything and that makes you feel sad from inside let's see how does my weekly priority go next week we'll see how did my current week go bro hey mate can you show me how you check that rank estimator masumali 4144 four.
You just got to go to Entrant Hub.
Entrant Hub.
Entrant Hub. Bro, we have a Discord, too, right? Is there any DSA baddies there on your server? Got to need some motivation to keep up with this [ __ ] Bro, this guy desperately needs a goon counter on his track. My life, this guy desperately needs a goon counter, bro.
He wants [ __ ] baddies, bro. You will only find catfishes on discord. Let me be honest. Is it like a field for which openings are there or is it same the requirement as tech? No, I I don't think so. Freshes get hired in Phops and it's I work in Phops because my company desperately needed some employees uh some like manpower in PHOPS as it's a very recent priority. I don't think so you particularly get hired for PHOPS.
Fin just basically helps me understand AWS and Azure on a broader context like reserve instances savings plan all the different services what are they eligible for saving my company money in cloud costs that's basically following the best practices on phob just search the phob subreddit on Reddit bro have you monetized your channel don't [ __ ] ask me I've lost all the money that I gained ranking system for goon countered shut the hell up sinister. Bro, you're always going to win. No, bro. You would be writing last year and all. My contest score and lead lead code research. Yo, hold on. Hold on. Look at what this guy is saying. My contest score and lead code. This guy is saying Dendra Solanki is saying my contest score and lead code reset to zero. Do you know why that happens, brother? Do you know why that happens? Do you know?
Do you know why that happens, brother?
because you [ __ ] cheated and got caught and got caught and the [ __ ] baddies chat timer also GF calls you I'll just I'll just add a custom metric format so that you can add your own metrics bro if you want to track cheater got caught with that variable cuz you performed too good shut up yo should we look at the email that I sent to those brands for sponsorship bro sponsorship did they reply let's see if they replied or not bro let's see if They reply to my email.
They [ __ ] did not. Hold on. It's a weekend. Why would they reply on a weekend? Yeah, they would not reply on a weekend, which is fair. They would not reply on a weekend. They have not replied it yet.
Okay, they've not replied yet.
Bro, remember me? Yo, is it Yo, Jean, are you are you from mate? Jean, are you from mate? Bro, I created an account just 5 seconds ago and I forgot the password.
[ __ ] dude. Yo, the for password option might just be missing. Hold on.
Oh [ __ ] I was muted. Give me one second.
Give it one second. Oh, I'm going to be prompting Claude to add the forhead password option because I ain't writing a [ __ ] line of code besides DS. You're not writing a bro expose a bug on stream. Bro, these bugs. Claude is responsible for these bugs, bro. Bro is back to 1,800 plus code rating. Let's go. Let's go. Jean, who the [ __ ] are you, bro? Tell me your name. Jean, bro, tell me your name. Do you you guys want to know what this [ __ ] did? Bro, I went to a senior junior interaction in my college where juniors were asking me questions and this asshole's question was, "Does minoxidil work?" Are we [ __ ] serious?
When I'm in a college meet and you're asking me, "Does minoxidil work?" Are we [ __ ] Kavia? You're Kavia.
Bro, you're getting your ass whooped today. Kavia, bro, you're getting your ass whooped today. You're cavia, bro. I didn't expect this from you. You're getting your ass whooped today, bro.
Cavia, bro, you're getting your ass whooped.
When I'm sitting I'm sitting in a formal settings, bro. In a formal setting in my college meet, juniors are asking me question and this guy is asking me, "Does minoxidil work?" Yeah, bro. You're getting your ass whooped, Kavia. Bro, I'm about to whoop your ass now. Are you ready for back shots? Yeah, bro.
Just shut up. Just shut up.
Okay, I guess that's it. That's it for this stream then.
Good week. Start tracking [ __ ] on track my life. I don't know how much rated does it need to get night 1840. 1840 1850. We all know why you went there, creep.
Where? Where? What's wrong in it? He was concerned. I've still not applied Minoxidil. Today is the day I'll apply Minoxidil, bro. Scribble now. Scribble is just too [ __ ] long. Help my GF give T. The [ __ ] do you mean T, bro?
GF gifts. T. What does that even mean?
Maybe that is the only question you can answer with prolevel experience, bro.
Is okay. Even if I can answer is that a question to ask during [ __ ] my college meet int valu nams as requested by the question that yeah I know somebody yeah that's [laughter] that's what cheaters do bro that's what cheaters do okay again I'm saying I'll be vlogging my each and every day on trackmylife.live live. If you do too, I'll review yours too and I'll review mine too at the end of this week on the next weekly contest stream on next stream I do. It was so damn bad. He just want to back juniors at this point. It was an online [ __ ] meet, Praep, you dumbass. It was an online [ __ ] me.
Shut up. How do you feel about your CTC?
17.3 LP, 15 LP fix. That's a lie. That's a lie. I don't know. Where did you get those numbers from? That's some grass.
Exactly bro. Exactly.
How to think for the third question or fourth? I solve 300 problems in lead code. I still can't.
Harsh Kumar Gupta. Just make sure you obsolve it. And now the next time a question like this comes, you can solve it. That's the only way to look at it.
If you couldn't solve it, no worries, bro. I forgot password option. I'll prompt Claude to do that. I'll prompt Claude to do that. That's it for the stream, bro.
Does iron give Cloud Max? Nah, bro. They they give they do give Cloud GitHub Copilot Pro version, but I'm using my own my own cloud pro. I've bought my own Cloud Pro. That's true. Maybe even more.
What? Yeah. Is promoting own project allowed here? Sure, bro. Sure.
Company location.
I forgot to apply my sales option.
Okay, that's all. How do you keep people private on how do you keep people private on your track my life? I would not see I've not added encryption. There is an option in settings to keep your profile public or private. But even if it's private, I would still say don't just just don't use it then because I've not added encryption. Either I'll have to add encryption end to end encryption so that even I cannot read your like the database currently storing plain text plain text for your daily logs. I'll see I'll see I'll improve it. Not me claude bro. I think you have a great potential to become influencer. You should try some different niche contents.
Should I like what should I start bouncing on reals? Should I? Maybe, bro.
Maybe. Maybe someday. If I get laid off or fired, we might. We might. What person minoxidil?
5% minoxidil. 0.1% fins the ride. That's all.
Okay. I'm yapping too much. I'm going to go sleep. Among Heist gaming, [ __ ] yeah, bro. Okay, I'm sorry. This guy can't just [ __ ] disrespect me like that. One immogle and I'm I'm about to mock the [ __ ] out of him. That's all.
After that, I'm going to end stream, but I need to [ __ ] humble his ass, bro. I need to humble his ass.
You won because it was It was I don't know. Why did you want join this?
Been using five person been five person using it for an air gun. Got only baby hairs, bro. Hold on. So, did you use winsterite too? Did you use finerite too, bro? Or only minoxidil? Mine is a mixture. Ice gaming. Join brother. Join if you have guts.
Okay. Morgle with showing your hairline, not hiding it. Shut up. Hello, Takubai.
Hello. And he got [ __ ] scared.
Oh [ __ ] Oh [ __ ] Hold on. Hold on.
Yeah, bro. Enough. Enough of you.
This guy is going down.
I just refuse to [ __ ] believe that he's a knight. This is absolute nah, bro. You're not. And um this guy attained a >> nine, bro. Shut the [ __ ] up, >> bro. What? What did he say? What did he say? And he got a nine yesterday, too.
Is he Is he [ __ ] Marlon, bro? How the hell does he do it every time?
He is Chad. Bro, he got a nine yesterday, too. And nine.
I don't know, bro. Maybe he has a mustache or something. He got a nine yesterday, too. I thought it was a glitch, but he's really nine out of 10, I guess. Bro, lost to him.
I don't [ __ ] understand. Fin step two, but his dumb ass gave him that.
Now, guess shut the [ __ ] up. It's not that bad.
It's not that bad, bro. Why don't you explore and get some girls? Where, bro?
Where can I explore? Tell me where can I explore?
App is white coded, bro. Bro, how the hell does he always get a nine then?
Any tips for me just to get an internship? I'm a BCF student. Build in public. Keep the face like stone emoji.
I was even flexing my traps and [ __ ] monkey. Okay. Okay, he he got nine again. Bro, this guy is a Chad. He might just be a Chad, bro.
Okay, then Monkey app have to find girls.
There are never any girls. Are there Are there girls in Monkey app?
Are there actually girls in Monkey app?
Oh, it's all it's all men. It is. It is all men. That's why I'm not even trying.
M Thailand 69 weeks. Shut up.
Approach every girl you see.
Bro, these guys are going to [ __ ] get me land in jail or what? Let's do once more with him. Shut up, bro. That guy has I don't know. Is he hacking or something? He always gets a nine. I don't I don't want to do it. I don't want to do it, bro. He He gets a nine every time. High gaming. I don't know how the [ __ ] does he do that.
Okay, it's 10:00 a.m. Good weekend.
Track my life.
Let's Let's meet the next weekend. Hope you have a good week, bro. Keep tracking your days and we're going to review them next week. Thanks for joining. Bye-bye.
Have a good week.
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

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

LIVE NOW! Cellular Structure and Functions | Complete Cell Biology Lecture | Anatomy & Physiology
MukhtarAliyu-t7m
387 views•2026-07-23