← Infosys questions

Maximum difference between crest and trough indices

Filed under Infosys

Given an array of integers, identify all 'crests' (local maxima) and 'troughs' (local minima). A crest is an element greater than its neighbors, and a trough is smaller than its neighbors. Find the…

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 Infosys questions

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