HashhMapp

74 posts

HashhMapp banner
HashhMapp

HashhMapp

@RabbitBris7667

I explain algorithm of almost every leetcode question in my own way .I believe this will help people too

Katılım Kasım 2024
49 Takip Edilen3 Takipçiler
HashhMapp
HashhMapp@RabbitBris7667·
have been solving regularly , but difficult to post , so gonna dive into , building agentic stuff for automated x posts , let me try to figure out
HashhMapp tweet media
English
0
0
1
3
HashhMapp
HashhMapp@RabbitBris7667·
First handle the 'T', make all required changes in the array, if any conflict occurs return "". Then handle 'F', and if a substring matches str2, change one unlocked character to break it, iterating from right to left to keep the string smallest. I hope this will help.
HashhMapp tweet mediaHashhMapp tweet media
English
0
0
1
4
HashhMapp
HashhMapp@RabbitBris7667·
solved this monotonic stack question with a little trick that i found as soon as i saw the question
HashhMapp tweet media
English
0
0
1
3
HashhMapp
HashhMapp@RabbitBris7667·
getting myself familiar with the monotonic stack and when to use index and when to use value inside the stack for better readability , solved in 10 min
HashhMapp tweet media
English
0
0
0
2
HashhMapp
HashhMapp@RabbitBris7667·
must try question for peeps who consider raw coding to be interesting solution is actually divided into 4 parts
HashhMapp tweet mediaHashhMapp tweet mediaHashhMapp tweet mediaHashhMapp tweet media
English
0
0
0
1
HashhMapp
HashhMapp@RabbitBris7667·
#POTD 2 solved , using matrix projection and prefix sum of tracking the sum till the end i didn't get the final catch in the final loops of traversing just till len(grid) - 1 . walked through various solutions to find it out
HashhMapp tweet media
English
0
0
1
13
HashhMapp
HashhMapp@RabbitBris7667·
proceeded with min stack , slowly understanding the fundamentals again
HashhMapp tweet media
English
0
0
1
2
HashhMapp
HashhMapp@RabbitBris7667·
stack 1 st question done right
HashhMapp tweet media
English
0
0
1
2
HashhMapp
HashhMapp@RabbitBris7667·
#Potd from now on and today is day 1 i think you guys can start with me as welll
HashhMapp tweet media
English
0
0
1
11
HashhMapp
HashhMapp@RabbitBris7667·
problem basic sliding window , done , since revisiing stack , i am re learning the implementation so solved this question
HashhMapp tweet media
English
0
0
1
2
HashhMapp
HashhMapp@RabbitBris7667·
THIS IS MY LAST QUESTION ON FIXED/MOVING SLIDING WINDOW , I THINK , I AM ALMOST DONE WITH THE CONCEPTS , I WILL START POSTING MORE ABOUT STACKS FROM TOMORROW, UNTIL THEN IT IS YOUR HASHMAPPP SIGNING OFFFF
HashhMapp tweet media
English
0
0
1
4
HashhMapp
HashhMapp@RabbitBris7667·
Spent 2 days in solving this question , ended up googling it and finding it using the hint , i think using dequeue for index to track elements within the range is the catch you will get
HashhMapp tweet media
English
0
0
0
2
Ayushi
Ayushi@Ayushi_sharma02·
#hiring interns Source One is hiring an SDE Intern! Salary: 25k - 40k / month Location: Pune, India -Basic programming knowledge in Java, Python, or C++ -Familiarity with JavaScript frameworks like Node.js and React.js is a plus Let me know if you are interested 👇
English
158
4
240
16.6K
HashhMapp
HashhMapp@RabbitBris7667·
(Window Length) - (Max Char Frequency) <= K Treat K as your budget. Max Char is your dominant letter, and everything else is a minority character you have to spend your K flips on! Pro-Tip: When shrinking the window, you never need to decrease your max_freq variable.
HashhMapp tweet media
English
0
0
1
3
HashhMapp
HashhMapp@RabbitBris7667·
No Extra Memory: We aren't creating substrings or hash maps. We literally just move i and j back and forth. O(1) space The Reset Logic: By setting i back to the start of the valid window during the backward pass, the outer loop naturally increments it by 1 for the next iteration
HashhMapp tweet media
English
0
0
0
23
HashhMapp
HashhMapp@RabbitBris7667·
we used count == lent to track when the window is valid. This is an incredibly powerful technique for "Minimum Window" problems involving multiple different characters. Instead of checking if the entire dictionary matches every single loop, you just track a single integer count
HashhMapp tweet media
English
0
0
0
3
HashhMapp
HashhMapp@RabbitBris7667·
Trying to find exactly K distinct elements breaks the standard sliding window because it doesn't know when to stop shrinking. The Master Trick: Exactly(K) = AtMost(K) - AtMost(K-1)
HashhMapp tweet media
English
0
0
1
8
HashhMapp
HashhMapp@RabbitBris7667·
If the string is "abcabc", when right hits the second "a", your while loop, 'a' is already in the set. Remove whatever is at the left pointer and move left forward until the old 'a' is gone. Once the old "a" is deleted, the while loop breaks, the new "a" is added.
HashhMapp tweet media
English
0
0
1
2
HashhMapp
HashhMapp@RabbitBris7667·
Init to Infinity: Set length = float('inf'). Overshoot is fine: Use while sum >= target. A valid window just needs to hit or exceed the target. Record, then Shrink: Put min() INSIDE the while loop. Capture the valid window's size before you shrink it to hunt for a smaller one.
HashhMapp tweet media
English
0
0
1
7
HashhMapp
HashhMapp@RabbitBris7667·
Instead of using "right" and "left" pointers and subtract/add from the dictionary (which is incredibly hard ) , we just build a fresh dict2 for every valid window size. Because the maximum window size isn't usually that huge in this problem, this passes nicely!
HashhMapp tweet media
English
0
0
1
3