Minimize Array Amplitude After Removing a Contiguous Block

Quick Overview

This Hudson River Trading software engineering question evaluates array reasoning for minimizing amplitude after removing a contiguous block. It prepares candidates to think about range effects, prefix and suffix information, and edge cases around removal length.

Minimize Array Amplitude After Removing a Contiguous Block

Company: Hudson River Trading

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Technical Screen

Given an array of integers and an integer `K`, remove exactly `K` contiguous elements so that the amplitude of the remaining array, defined as `max(remaining) - min(remaining)`, is minimized. Return the minimum possible amplitude. ### Constraints & Assumptions - The remaining array is non-empty. - K is between 0 and n-1 unless clarified. - The removed elements must be contiguous. - Aim for O(n) after preprocessing or direct linear scans. ### Clarifying Questions to Ask - Can K be zero? - Can numbers be negative? - If multiple removals tie, do we need the indices? - What should happen if K equals n? - How large is n? ### What a Strong Answer Covers ```premium-lock What a Strong Answer Covers ``` ### Follow-up Questions - How would you return the removed interval? - How would this change for removing up to K elements? - Can you do it with less memory? - How would updates to the array affect the design?

Quick Answer: This Hudson River Trading software engineering question evaluates array reasoning for minimizing amplitude after removing a contiguous block. It prepares candidates to think about range effects, prefix and suffix information, and edge cases around removal length.

|Home/Software Engineering Fundamentals/Hudson River Trading
Hudson River Trading logo
Hudson River Trading
Jul 2, 2026, 7:02 PM
mediumSoftware EngineerTechnical ScreenSoftware Engineering Fundamentals
11
0

Given an array of integers and an integer K, remove exactly K contiguous elements so that the amplitude of the remaining array, defined as max(remaining) - min(remaining), is minimized. Return the minimum possible amplitude.

Constraints & Assumptions

  • The remaining array is non-empty.
  • K is between 0 and n-1 unless clarified.
  • The removed elements must be contiguous.
  • Aim for O(n) after preprocessing or direct linear scans.

Clarifying Questions to Ask Guidance

  • Can K be zero?
  • Can numbers be negative?
  • If multiple removals tie, do we need the indices?
  • What should happen if K equals n?
  • How large is n?

What a Strong Answer Covers Premium

Follow-up Questions Guidance

  • How would you return the removed interval?
  • How would this change for removing up to K elements?
  • Can you do it with less memory?
  • How would updates to the array affect the design?
Loading comments...