Question bank › Monotonic Stack
Dsa Monotonic Stack Hard

Next Higher Weight

You are given a list of weights of packages delivered each day. For each package, you need to find the next higher weight that was delivered after it. If there is no higher weight in subsequent days, return -1 for that package. Input Format: - A single line containing space-separated integers representing the weights. Output Format: - A list of integers representing the next higher weight for each package. Example: Input: 10 20 15 25 30 20 Output: [20, 25, 25, 30, -1, -1]

Key concepts

monotonic_stackweight_distributionarray

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.