← Swiggy questions
CodingReported in a candidate post, Jul 2025

Next greater element in O(n)

Filed under Swiggy

Given an array of integers, return an array where each position holds the next greater element to its right (the first larger value that appears later), or -1 if none exists. Solve it in O(n) using a…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Swiggy questions

Collected from public candidate posts and coding forums. Updated Nov 2026.