Choose an Offset for Compressing Clustered Integers with Outliers

Quick Overview

Choose an offset for clustered integer compression using a maximum-coverage sliding window. Make the codec reversible and account for bit width, outlier markers, metadata, and the limits of coverage-only optimization.

Choose an Offset for Compressing Clustered Integers with Outliers

Company: Headlands

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: hard

Interview Round: Technical Screen

Most integers in a dataset are concentrated in a narrow range, with a few outliers. Choose an offset that reduces storage, and explain how a sliding window can identify a useful range. ### Clarifying Questions The compact bit width, outlier encoding, signedness, metadata cost, and exact storage objective are unspecified. For the worked analysis, choose a fixed w-bit unsigned offset code with a separate inlier/outlier indicator, and store outliers in a wider representation. The offset is stored once per block. These are explicit codec assumptions, not supplied requirements. ### What a Strong Answer Covers A reversible encoding, the range covered by an offset, a maximum-coverage window algorithm, complete storage accounting, and the difference between selecting an offset for fixed width and optimizing the width itself. ### Follow-up Questions - What changes if one compact code value is reserved as an escape marker? - When could offset metadata make compression larger than the original data?

Overview: Choose an offset for clustered integer compression using a maximum-coverage sliding window. Make the codec reversible and account for bit width, outlier markers, metadata, and the limits of coverage-only optimization.

Headlands logo
Headlands
Oct 26, 2026
hardSoftware EngineerTechnical ScreenSoftware Engineering Fundamentals
0
0

Most integers in a dataset are concentrated in a narrow range, with a few outliers. Choose an offset that reduces storage, and explain how a sliding window can identify a useful range.

Clarifying Questions Guidance

The compact bit width, outlier encoding, signedness, metadata cost, and exact storage objective are unspecified. For the worked analysis, choose a fixed w-bit unsigned offset code with a separate inlier/outlier indicator, and store outliers in a wider representation. The offset is stored once per block. These are explicit codec assumptions, not supplied requirements.

What a Strong Answer Covers Guidance

A reversible encoding, the range covered by an offset, a maximum-coverage window algorithm, complete storage accounting, and the difference between selecting an offset for fixed width and optimizing the width itself.

Follow-up Questions Guidance

  • What changes if one compact code value is reserved as an escape marker?
  • When could offset metadata make compression larger than the original data?