Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Next Hotter Day
00:00
5 left

Next Hotter Day

MediumPython

Problem

Given a list of daily temperatures, find the next hotter day position for each day.

Implement def next_hotter_day_positions(temperatures):. Return an array where each value is the index of the first later day with a strictly higher temperature, or -1 if no such day exists. If multiple later days qualify, return the earliest one.

Constraints

  • 0 <= temperatures.length <= 1000
  • 0 <= temperatures[i] <= 10^5
  • A hotter day must occur at a strictly greater index
  • Equal temperatures do not count as hotter

Function Signature

def next_hotter_day_positions(temperatures):
Interviewer

Your question is Next Hotter Day. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.