FastPrepDaily Temperatures
Problems/Daily Temperatures

Daily Temperatures

eBay logoeBay● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives the full rule for the result about warmer days and asks for a walk through an example. It does not give a function signature or number limits. Our version is about 98% the same as the reported question.

Given an integer array temps, return an array answer of the same length. For each index i, answer[i] is the number of days until the first later day whose temperature is strictly greater than temps[i].

If no later day is warmer, set answer[i] = 0.

Function

dailyTemperatures(temps: int[]) → int[]

Examples

Example 1

temps = [73,74,75,71,69,72,76,73]return = [1,1,4,2,1,1,0,0]

For day 2 with temperature 75, the next warmer value is 76 four days later. The final two days have no later warmer value.

Example 2

temps = [30,40,50,60]return = [1,1,1,0]

Each of the first three days is followed immediately by a warmer day.

Example 3

temps = [30,60,90]return = [1,1,0]

The next day is warmer for the first two entries, while the last entry has no future day.

Constraints

  • 1 <= temps.length <= 100000.
  • -10^9 <= temps[i] <= 10^9.

More eBay Onsite Interview questions

  • Extract Hashtags from a TweetONSITE INTERVIEW · Seen Nov 2026
  • Validate Ada Integer LiteralONSITE INTERVIEW · Seen Nov 2026
  • Count Distinct Pairs With Sum KONSITE INTERVIEW · Seen Nov 2026
  • Diameter of Binary TreeONSITE INTERVIEW · Seen Nov 2026
  • Count Staircases with Strictly Increasing StepsONSITE INTERVIEW · Seen Oct 2026
  • Hierarchical Permission CheckONSITE INTERVIEW · Seen Oct 2026
  • Matrix MultiplicationONSITE INTERVIEW · Seen Oct 2026
  • N-Queens Solution CountONSITE INTERVIEW · Seen Oct 2026
  • Gas StationONSITE INTERVIEW · Seen Oct 2026
  • Onion-Peel Layers of a Binary TreeONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Compress Editor Actions into Operational Transform OperationsReplit · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Flatten a Mixed JSON ListNike, Inc. · ONSITE INTERVIEWNike, Inc. interview questions
  • Fountain SafetyGoogle · ONSITE INTERVIEWGoogle interview questions
  • Trace Events from Stable Whole-Stack StatesAnthropic · ONSITE INTERVIEWAnthropic interview questions
  • Next Smaller Ticket PriceAmazon · ONSITE INTERVIEW
  • Next Greater Element to the RightTekion · ONSITE INTERVIEWTekion interview questions
  • Surviving Balls after Directional CollisionsSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Asteroid CollisionAdobe · ONSITE INTERVIEWAdobe interview questions
  • Most Frequent Call Path in Interleaved LogsRoblox · ONSITE INTERVIEWRoblox interview questions
  • Flatten a Nested ArrayFreshworks · ONSITE INTERVIEWFreshworks interview questions
All eBay interview questionsSee eBay hiring insights
Saved
class Solution {
    public int[] dailyTemperatures(int[] temps) {
        // Write your code here.
    }
}
Checking account…