Daily Temperatures | Monotonic Stack | Animated DSA Explanation in Java
AlgoRung
0:00 / 0:00
Daily Temperatures | Monotonic Stack | Animated DSA Explanation in Java
4 просмотра · 11 дн. назад
AlgoRung
9 подписчиков
4 просмотра · 11 дн. назад
Daily Temperatures (Medium) explained step by step with animations: the idea, a brute force, the optimal solution and its complexity, with Java code.
Given daily temperatures, return an array where answer[i] is the number of days until a warmer temperature after day i. If no warmer day comes, use 0.
Java code + notes: https://algorung.com/dsa/monotonic-st...
Practise it with spaced revision: https://algorung.com/app/problems/dai...
Chapters
0:00 The problem
0:34 Look ahead from every day
1:13 Days waiting for warmth
1:50 Day by day
3:01 Complexity
3:16 Edge cases & recap
Similar problems
• Next Greater Element I: https://algorung.com/dsa/monotonic-st...
• Next Greater Element II: https://algorung.com/dsa/monotonic-st...
• Largest Rectangle in Histogram: https://algorung.com/dsa/monotonic-st...
More Monotonic Stack problems: https://algorung.com/dsa/monotonic-stack
All patterns: https://algorung.com/patterns
#DSA #MonotonicStack #DailyTemperatures #Java #CodingInterview #LeetCode #AlgoRung