Quick Overview

Restore a nearly sorted array after at most one element was removed and reinserted elsewhere. The problem tests linear-time reasoning, constant auxiliary-space goals, duplicates, negative values, already-sorted input, and boundary cases without mutating the caller's array.

Restore an Array with One Displaced Element

Company: Glean

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Overview: Restore a nearly sorted array after at most one element was removed and reinserted elsewhere. The problem tests linear-time reasoning, constant auxiliary-space goals, duplicates, negative values, already-sorted input, and boundary cases without mutating the caller's array.

Loading…