andreyka26_se
Daily (154 day streak) Good dp problem. Actually very similar to common subsequence. https://leetcode.com/problems/minimum-ascii-delete-sum-for-two-strings/description/?envType=daily-question&envId=2026-01-10 #daily #medium
So, for new people, I'm doing leetcode for a long time. And sometimes I'm pasting here useful templates / approaches for leetcode questions (as they are needed for interview).
Today given good 2dp problem we will see how to convert top-down to bottom up (without applying much thinking).
1. Come up with exponential recursion that has input and produces (stateless) output for it
2. Add memoization with @cache decorator
3. Apply array based cache (-1 element does not exist)
4. Slightly imagine the callstack of recursion, and reverse it with for loop.
4.1 Depending on your recursion, realize where input starts, where it ends. In our case we start from
4.2 Create these reversed for loops
4.3 Check base cases, and precalculate base cases before for loop
4.4 All remaining code is the same as in top down except (return ans). Change recursive calls to cache calls
5. You are welcome
Today given good 2dp problem we will see how to convert top-down to bottom up (without applying much thinking).
1. Come up with exponential recursion that has input and produces (stateless) output for it
2. Add memoization with @cache decorator
3. Apply array based cache (-1 element does not exist)
4. Slightly imagine the callstack of recursion, and reverse it with for loop.
4.1 Depending on your recursion, realize where input starts, where it ends. In our case we start from
0,0 and end at len(s1) or len(s2). So for bottom up we should reverse -> we start from len(s1) & len(s2) and go up from bottom to 0,0.4.2 Create these reversed for loops
4.3 Check base cases, and precalculate base cases before for loop
4.4 All remaining code is the same as in top down except (return ans). Change recursive calls to cache calls
5. You are welcome
π4
For today's daily, people suggest to solve this question:
https://leetcode.com/problems/largest-rectangle-in-histogram/
it should be actually good, but I'm a bit struggling to finish it. So seems like tomorrow's daily is going to be pretty hard.
There is also a note that max area rectangle is solved COMPLETELY different way than max area square.
https://leetcode.com/problems/largest-rectangle-in-histogram/
it should be actually good, but I'm a bit struggling to finish it. So seems like tomorrow's daily is going to be pretty hard.
There is also a note that max area rectangle is solved COMPLETELY different way than max area square.
LeetCode
Largest Rectangle in Histogram - LeetCode
Can you solve this real interview question? Largest Rectangle in Histogram - Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram.
Exampleβ¦
Exampleβ¦
π3
Daily (155 day streak).
Well, today is pretty hard question. As I mentioned above, better to solve the question before that, which will be used as subsolution to today's daily.
I'm just happy it is Sunday and I was not in a rush
https://leetcode.com/problems/maximal-rectangle/description/?envType=daily-question&envId=2026-01-11
#daily #hard
Well, today is pretty hard question. As I mentioned above, better to solve the question before that, which will be used as subsolution to today's daily.
I'm just happy it is Sunday and I was not in a rush
https://leetcode.com/problems/maximal-rectangle/description/?envType=daily-question&envId=2026-01-11
#daily #hard
π₯2
Daily (156 day streak)
Happy Monday. Easy problem, after yesterday's problem feels fckng amazing.
https://leetcode.com/problems/minimum-time-visiting-all-points/description/?envType=daily-question&envId=2026-01-12
#daily #easy
Happy Monday. Easy problem, after yesterday's problem feels fckng amazing.
https://leetcode.com/problems/minimum-time-visiting-all-points/description/?envType=daily-question&envId=2026-01-12
#daily #easy
π5π₯1
Daily (157 day streak)
Today is pretty interesting problem. Binary search on real numbers. I would not say it is very easy, and it uses some sort of "unique" technique that you never seen before.
https://leetcode.com/problems/separate-squares-i/solutions/6426084/binary-search-by-fahad_mubeen-k83n/?envType=daily-question&envId=2026-01-13
#daily #medium
Today is pretty interesting problem. Binary search on real numbers. I would not say it is very easy, and it uses some sort of "unique" technique that you never seen before.
https://leetcode.com/problems/separate-squares-i/solutions/6426084/binary-search-by-fahad_mubeen-k83n/?envType=daily-question&envId=2026-01-13
#daily #medium
π9
https://leetcode.com/problems/rectangle-area-ii/description/
I'll be honest with you I don't give a shit about how to solve it, because of above.
I mean segment tree on it's own is already hard enough thing. Now we should put it, add sweep line and hell knows what else.
Instead of this I would do some hard task from top 100 liked questions, sorry, go unsubscribe if I disappointed somebody
I'll be honest with you I don't give a shit about how to solve it, because of above.
I mean segment tree on it's own is already hard enough thing. Now we should put it, add sweep line and hell knows what else.
Instead of this I would do some hard task from top 100 liked questions, sorry, go unsubscribe if I disappointed somebody
π10
Punishment problem (for not solving daily)
From top 100 liked questions. I would not say to be honest that it is hard. I would rate as mid.
https://leetcode.com/problems/minimum-window-substring/description/?envType=study-plan-v2&envId=top-100-liked
#punishment #hard
From top 100 liked questions. I would not say to be honest that it is hard. I would rate as mid.
https://leetcode.com/problems/minimum-window-substring/description/?envType=study-plan-v2&envId=top-100-liked
#punishment #hard
π4
Daily (159 day streak)
Today, is good medium problem. And very nice hints in case you don't come up with intuition.
Just small hint from my side, you must return maximum SQUARE, not rectangle. This what was not working for me.
https://leetcode.com/problems/maximize-area-of-square-hole-in-grid/description/?envType=daily-question&envId=2026-01-15
#daily #medium
Today, is good medium problem. And very nice hints in case you don't come up with intuition.
Just small hint from my side, you must return maximum SQUARE, not rectangle. This what was not working for me.
https://leetcode.com/problems/maximize-area-of-square-hole-in-grid/description/?envType=daily-question&envId=2026-01-15
#daily #medium
π6
https://youtu.be/2jqS7wN-yzs?si=p-mOHGr30UY6dROc
Absolute sigma. I am personally web dev to some extend, but way more down on infra. But still, he is legend, and tells the truth. Sometimes people produce this:
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
Absolute sigma. I am personally web dev to some extend, but way more down on infra. But still, he is legend, and tells the truth. Sometimes people produce this:
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
YouTube
The Problem with the Web
Jonathan Blow explains what is wrong with the web.
Tip me: https://ko-fi.com/blowfan
Jon's Twitch: https://www.twitch.tv/j_blow
Tip me: https://ko-fi.com/blowfan
Jon's Twitch: https://www.twitch.tv/j_blow
π₯2
Daily (160 day streak)
Don't be scared by 20% acceptance rate, actually it is not hard. Hints are again very useful, and basically will give you a solution.
https://leetcode.com/problems/maximum-square-area-by-removing-fences-from-a-field/description/?envType=daily-question&envId=2026-01-16
#daily #medium
Don't be scared by 20% acceptance rate, actually it is not hard. Hints are again very useful, and basically will give you a solution.
https://leetcode.com/problems/maximum-square-area-by-removing-fences-from-a-field/description/?envType=daily-question&envId=2026-01-16
#daily #medium
π5
Media is too big
VIEW IN TELEGRAM
Best experience with government/public services ever. Slavic people - you will understand.
π₯8β€5
This media is not supported in your browser
VIEW IN TELEGRAM
I found an apartment already, and I guess I have amazing neighbourπππ
π₯19β€10
Daily (161 day streak)
Today is pretty nice and interesting problem, that involves a bit of Cortasian plane knowledge and a bit of geometry knowledge, but very basic one.
https://leetcode.com/problems/find-the-largest-area-of-square-inside-two-rectangles/description/?envType=daily-question&envId=2026-01-17
#daily #medium
Today is pretty nice and interesting problem, that involves a bit of Cortasian plane knowledge and a bit of geometry knowledge, but very basic one.
https://leetcode.com/problems/find-the-largest-area-of-square-inside-two-rectangles/description/?envType=daily-question&envId=2026-01-17
#daily #medium
π2β€1