Websocket server and client ping each other. If connection is getting timed out - client will initiate reconnect which will override the data about itself in Redis.
❤2
Do you remember distributed lock system design pattern? Basically one of the most famous algos is RedLock - implementation based on Redis (you do atomic set with TTL claiming the lock and the atomically removing the record).
So, this solution actually has a lot of critic, and one of the critics is done by Martin Kleppmann (this guy who wrote Designing data intensive applications)
https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html
So, this solution actually has a lot of critic, and one of the critics is done by Martin Kleppmann (this guy who wrote Designing data intensive applications)
https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html
❤2
So, the guy who created RedLock algo made A DISS ON MARTIN.
THIS IS SO FUNNY AND EPIC IN A SENSE
DISTRIBUTED BATTLE
THIS IS SO FUNNY AND EPIC IN A SENSE
DISTRIBUTED BATTLE
I didn't find Martin's analysis on Salvatore's analysis on Martin's analysis on Salvatore's RedLock (((
TL; DR
RedLock (Redis based lock using SET NX + TTL) might not be that accurate and correct.
If you plan to use it for some critical functionality - stick to proper concensus (raft, paxos)
RedLock (Redis based lock using SET NX + TTL) might not be that accurate and correct.
If you plan to use it for some critical functionality - stick to proper concensus (raft, paxos)
❤4
Today we are streaming, +- 20:00 Prague time.
Topics: 2dimensional DP + Redis Sharding implementation on hashslots
Topics: 2dimensional DP + Redis Sharding implementation on hashslots
🔥3
We are doing LeetRooms with friends. This is semi competitive thing, when we select 4 problems and solve with leaderboard, etc
Let's also check the problems during stream really quickly they are not some bullshit, but pretty simple and cover couple of basic leetcode patterns to revise
Let's also check the problems during stream really quickly they are not some bullshit, but pretty simple and cover couple of basic leetcode patterns to revise
❤1👍1
Daily
https://leetcode.com/problems/new-21-game/description/?envType=daily-question&envId=2025-08-17
btw, fuck daily today, it is not mid, explanation in the solutions afterwards
#daily
https://leetcode.com/problems/new-21-game/description/?envType=daily-question&envId=2025-08-17
btw, fuck daily today, it is not mid, explanation in the solutions afterwards
#daily
Naive solution:
add the probabilities of all sequences that lead to score <= k.
For that try every possible choice (it has probability {1/ numofchoices} * subproblem's probability.
Dp optimization:
Top-down and bottom up DP is pretty simple, it will optimize Complexity from O(maxPts ^ k) to O(k ^ maxPts). BUT FOR THIS FUCKING MIDDLE IT IS NOT ENOUGH
Sliding window optimization:
You clearly see that at each iteration of score, we are recalculating contiguous subproblems score+1, score + 2, score + 3, ... score + maxPts
The optimization would be to remove this summing, and just use precalculated window of sums (tbh was not able to figure it out on my own)
For that try every possible choice (it has probability {1/ numofchoices} * subproblem's probability.
Dp optimization:
Sliding window optimization:
The optimization would be to remove this summing, and just use precalculated window of sums (tbh was not able to figure it out on my own)
❤3
Yea, it was great Sunday midday, and then you fucking spent 2-3 hours on stupid problem that if somebody even ask during interview - they just don't want hire you
😁10❤2👍1