[Solution]Problem 81: Daily Temperatures [Microsoft]
Hey, it’s your favorite cult leader here 🐱👤
On Thursdays, I will send you a problem + its solution. These solutions will help you reinforce your fundamental concepts, improve your problem-solving, and kill those Leetcode-Style Interviews. 🔥🔥💹💹
To get access to all my articles and support my crippling chocolate milk addiction, consider subscribing if you haven’t already!
p.s. you can learn more about the paid plan here.
Talked about the spring; had a winter storm,
God Bless Rochester. What’s the weather like in your part of the world? I’d be curious to know.
This question can be found as Leetcode 739. Daily Temperatures.
Given an array of integers
temperatures represents the daily temperatures, return an array
answer such that
answer[i] is the number of days you have to wait after the
ith day to get a warmer temperature. If there is no future day for which this is possible, keep
answer[i] == 0 instead.
Input: temperatures = [73,74,75,71,69,72,76,73] Output: [1,1,4,2,1,1,0,0]
Input: temperatures = [30,40,50,60] Output: [1,1,1,0]
Input: temperatures = [30,60,90] Output: [1,1,0]
1 <= temperatures.length <= 105
30 <= temperatures[i] <= 100
Keep reading with a 7-day free trial
Subscribe to Technology Made Simple to keep reading this post and get 7 days of free access to the full post archives.