Minimize moves to transform floor layouts

Quick Overview

This question evaluates algorithm design and combinatorial optimization skills, focusing on reasoning about minimal moves, greedy heuristics, and proving optimality within the Coding & Algorithms domain for data-science technical roles.

Minimize moves to transform floor layouts

Company: Optiver

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Take-home Project

You are given an initial arrangement of apartments across Floors 1–4 and a target arrangement. In one move you may reposition a single apartment to a different floor (assume any move is allowed unless it violates the target’s per-floor apartment counts). Design an algorithm to transform the initial arrangement into the target using the fewest moves. Answer the following: - Describe your algorithm and prove or argue its optimality. - Analyze its time and space complexity. - Evaluate the greedy strategy "fix Floor 1 first, then Floors 2–4": is it always optimal? Provide a counterexample or a proof. - If multiple optimal solutions exist, how would you output one sequence of moves?

Quick Answer: This question evaluates algorithm design and combinatorial optimization skills, focusing on reasoning about minimal moves, greedy heuristics, and proving optimality within the Coding & Algorithms domain for data-science technical roles.

|Home/Coding & Algorithms/Optiver
Optiver logo
Optiver
Sep 6, 2025, 12:00 AM
mediumData ScientistTake-home ProjectCoding & Algorithms
4
0

You are given an initial arrangement of apartments across Floors 1–4 and a target arrangement. In one move you may reposition a single apartment to a different floor (assume any move is allowed unless it violates the target’s per-floor apartment counts). Design an algorithm to transform the initial arrangement into the target using the fewest moves. Answer the following:

  • Describe your algorithm and prove or argue its optimality.
  • Analyze its time and space complexity.
  • Evaluate the greedy strategy "fix Floor 1 first, then Floors 2–4": is it always optimal? Provide a counterexample or a proof.
  • If multiple optimal solutions exist, how would you output one sequence of moves?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...