Find Warmest Temperature
This problem feels like checking a simple weather report. You have a list of temperatures, and you want to know which one was the warmest.
The answer is the largest number in the list. You do not need to sort everything or keep every result. You only need to remember the highest temperature seen so far.
For example, if the readings are [28, 31, 26, 33, 30], the answer is 33. Even though the temperatures go up and down, 33 is the highest value in the whole list.
If the list is empty, return -1 because there is no temperature to report.
Example Input & Output
33 is the highest reading in the list.
With one reading, that value is automatically the warmest.
An empty list has no valid temperature to return.
Algorithm Flow

Solution Approach
A good way to solve this is to keep track of the largest value while moving through the list.
First, handle the empty-list case. If there are no readings, return -1 right away.
If the list has values, start by storing the first temperature in a variable like warmest. That gives you a starting answer to compare against.
Then go through the rest of the readings one by one. Each time, compare the current reading with warmest.
The update step is:
If the current reading is higher, replace the old saved value. If it is not higher, keep the old one.
By the time the loop ends, warmest holds the largest temperature in the list.
Best Answers
Solutions Coming Soon
Verified best solutions for this Challenge are still being analyzed and will be available soon.
Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this Challenge.
