Trapping Rain Water
July 29, 2020Trapping rain water ilk bakışta görmek zor ancak şu şekilde düşünülebilir.
Engel uzunluklarını B dizisi ile ifade edelim. Herhangi bir i noktasındaki biriken su miktarına X(i) dersek
$$ X(i) = Min( max( B[k] k > i) , max(B[k] k < i ))) - B[i] $$
Bir noktanın sağındaki ve solundaki en uzun engelleri önceden hesaplarsak biz O(n) zamanlı çözümü verir.
|
|
hidden
John von Neumann – The Man from the Future
Before I read The Man from the Future by Ananyo Bhattacharya, I only knew about John von Neumann in two contexts: that computers use the von Neumann architecture, and that he appeared in a story about a mathematical problem I … Continue reading →
via Henrik Warne's blogThe Review Is the Action Item
2024/05/30The Review Is the Action ItemI like to consider running an incident review to be its own action item. Other follow-ups emerging from it are a plus, but the point is to learn from incidents, and the review gives room for that to happen.This is no…
via Ferd.caHOWTO: Change your behavior
In theory, behavior change should be easy. At first glance, it seems like you control your behavior. So, if you desire different behavior, why doesn’t your behavior change as instantly as your desire to change it? In short, lasting change of habitual behavio…
via Matt Might's blog