Practice
Longest Hot Streak
MEDIUMArrays7 marks
Read 7 daily temperatures into an array.
Output the length of the longest consecutive streak where the temperature is greater than 30.
Input: Seven integer temperatures. Output: One integer, the longest hot streak.
Example:
Input: 29
31
33
28
35
36
37
Output: 3
Premium is coming soon. All grading features are currently unlocked.
Sample Test Cases
Test 1: Best streak at the end
Inputs: 29, 31, 33, 28, 35, 36, 37
Expected: 3
Test 2: All hot days
Inputs: 31, 32, 33, 34, 35, 36, 37
Expected: 7
Test 3: 30 is not greater than 30
Inputs: 30, 29, 28, 27, 26, 25, 24
Expected: 0