andreyka26_se
During the daily, I discovered interesting compiler optimization or whatever it is. Case1. I'm using permutations *= cnt % mod => gives 3600ms Case2. I'm using permutations = permutations * cnt % mod => gives 11ms
UPD:
For now seems strange
permutations *= cnt -> 3000ms
permutations = permutations * cnt -> 3000ms
permutations = permutations * cnt % mod -> 17ms
permutations = (permutations * cnt) % mod -> 17ms
permutations *= cnt % mod -> 3000ms
For now seems strange
π€1
andreyka26_se
UPD: permutations *= cnt -> 3000ms permutations = permutations * cnt -> 3000ms permutations = permutations * cnt % mod -> 17ms permutations = (permutations * cnt) % mod -> 17ms permutations *= cnt % mod -> 3000ms For now seems strange
Actually makes sense. The smaller the numbers the quicker the multiplication.
p *= cnt % mod will be converted to p = p * (cnt % mod). So basically we will always work with bigger numbers
Order of operations isfrom left to right for β*β and β%β as they are same βrankβ
p *= cnt % mod will be converted to p = p * (cnt % mod). So basically we will always work with bigger numbers
Order of operations isfrom left to right for β*β and β%β as they are same βrankβ
π1π€―1
Daily (124 day streak)
Happy Thursday. Amazing problem, I love problems that are representing some abstract model, that you can imagine, or even better - real world model, rather than just some numbers. Today is exactly that type of problems
https://leetcode.com/problems/count-covered-buildings/description/?envType=daily-question&envId=2025-12-11
#daily #medium
Happy Thursday. Amazing problem, I love problems that are representing some abstract model, that you can imagine, or even better - real world model, rather than just some numbers. Today is exactly that type of problems
https://leetcode.com/problems/count-covered-buildings/description/?envType=daily-question&envId=2025-12-11
#daily #medium
π3
Fun fact, did you know you can add contributions/commits to github for the past and for future days. E.g. just added for 24th of Dec.
My ex techlead has shared the fun repo, and I was really doubting how it can add for the past or for the future, but it can for new empty repo
https://github.com/Shpota/github-activity-generator
My ex techlead has shared the fun repo, and I was really doubting how it can add for the past or for the future, but it can for new empty repo
https://github.com/Shpota/github-activity-generator
π₯2
Well actually even in already created repo, you can do it, and it will be reflected in activity.
Here I created commit in 2026th.
But you would need to play with query parameters in github so it is shown:
https://github.com/andreyka26-git?tab=overview&from=2025-12-01&to=2026-12-11
Here I created commit in 2026th.
But you would need to play with query parameters in github so it is shown:
https://github.com/andreyka26-git?tab=overview&from=2025-12-01&to=2026-12-11
π₯2π1
I love Google ecosystem for personal use, Tasks, Calendar, Keep (notes), Drive/Docs, etc.
The only one thing I was not happy about Google Notes (Keep) is rich text editing (bold, italic formats, headings, etc).
THEY HAVE ADDED IT!!!
Was waiting for it for 3-4 years. On top of that every now and then I see improvements and new features for Google Tasks.
Love Google. At some point I will be hired there. Want to work on some of these personal / time management tools.
The only one thing I was not happy about Google Notes (Keep) is rich text editing (bold, italic formats, headings, etc).
THEY HAVE ADDED IT!!!
Was waiting for it for 3-4 years. On top of that every now and then I see improvements and new features for Google Tasks.
Love Google. At some point I will be hired there. Want to work on some of these personal / time management tools.
π₯12
Daily (125 day streak)
Actually nice problem. Feels like some version of real engineering problem that somebody had.
https://leetcode.com/problems/count-mentions-per-user/description/?envType=daily-question&envId=2025-12-12
#daily #medium
Actually nice problem. Feels like some version of real engineering problem that somebody had.
https://leetcode.com/problems/count-mentions-per-user/description/?envType=daily-question&envId=2025-12-12
#daily #medium
π2
Daily (126 day streak)
Happy Saturday. Today is easy, so few mins problem - get your coin.
https://leetcode.com/problems/coupon-code-validator/?envType=daily-question&envId=2025-12-13
#daily #easy
Happy Saturday. Today is easy, so few mins problem - get your coin.
https://leetcode.com/problems/coupon-code-validator/?envType=daily-question&envId=2025-12-13
#daily #easy
π₯2
Daily (127 day streak)
It is Medium+ or even Medium, not Hard for sure. Especially given the hints.
https://leetcode.com/problems/number-of-ways-to-divide-a-long-corridor/description/?envType=daily-question&envId=2025-12-14
#daily #hard
It is Medium+ or even Medium, not Hard for sure. Especially given the hints.
https://leetcode.com/problems/number-of-ways-to-divide-a-long-corridor/description/?envType=daily-question&envId=2025-12-14
#daily #hard
π1
andreyka26_se
Vibe. Goal is to eventually finish this book before 2026. I gonna do a review, cause in my opinion the book is REALY overrated. What do you read nowadays?
Btw, I started 2 years ago. Slowly but surely. Really boring and redundantly complicated book
π₯5
Daily (128 day streak)
Happy Monday, easy one, or easy-mid. Good problem - go and collect the coin.
https://leetcode.com/problems/number-of-smooth-descent-periods-of-a-stock/description/?envType=daily-question&envId=2025-12-15
#daily #medium
Happy Monday, easy one, or easy-mid. Good problem - go and collect the coin.
https://leetcode.com/problems/number-of-smooth-descent-periods-of-a-stock/description/?envType=daily-question&envId=2025-12-15
#daily #medium
β€3
andreyka26_se
today's daily is hard, this is acceptance rate. But we are strong, there is discipline, so we gonna make it, however not before I go sleep
fuck it, tomorrow watching editorial. I came up with dp then realized the budget is shared var between dp subproblems(
π€―1
Daily (129 day streak)
The hardest dynamic programming question I have every had. First time I see that DP function returns not scalar, but map that should be merged. No way I'm solving it within 1 hour, however initial idea was almost fully correct
https://leetcode.com/problems/maximum-profit-from-trading-stocks-with-discounts/description/?envType=daily-question&envId=2025-12-16
#daily #hard
The hardest dynamic programming question I have every had. First time I see that DP function returns not scalar, but map that should be merged. No way I'm solving it within 1 hour, however initial idea was almost fully correct
https://leetcode.com/problems/maximum-profit-from-trading-stocks-with-discounts/description/?envType=daily-question&envId=2025-12-16
#daily #hard
π₯5
FUCK LEETCODE. omg these people again fucked up. So, today's daily (will post in a bit) is dp problem. I solved using 3 dp variables (top down memoization), and it hits memory limit.
Trying to put @cache -> memory limit. Trying to put @lru_cache -> time limit. Stupid shit required you TO FUCKING CLEAN THE CACHE BEFORE RETURNING ANSWER.
WTF??
So on the picture without
They also did it in editorial, CAUSE GUESS WHAT IT WILL ALSO FAIL WITH MEMORY LIMIT.
Trying to put @cache -> memory limit. Trying to put @lru_cache -> time limit. Stupid shit required you TO FUCKING CLEAN THE CACHE BEFORE RETURNING ANSWER.
WTF??
So on the picture without
cache = {} it won't work...They also did it in editorial, CAUSE GUESS WHAT IT WILL ALSO FAIL WITH MEMORY LIMIT.
π6π₯1π€‘1