โ† Visa questions

Remove smallest peak repeatedly until empty

Filed under Visa

Given an array of distinct elements, repeatedly find the smallest peak (an element greater than its neighbours), remove it, and return the sequence of removed peaks until the array is empty.

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

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