Quick Overview

Copy a rectangular block of a 2D array to another position in the same array, in place with O(1) extra memory, where the source and destination blocks may overlap. Tests choosing a safe copy direction so that no value is overwritten before it is read.

In-Place Rectangle Copy Within a 2D Array Using O(1) Extra Memory

Company: Waymo

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Overview: Copy a rectangular block of a 2D array to another position in the same array, in place with O(1) extra memory, where the source and destination blocks may overlap. Tests choosing a safe copy direction so that no value is overwritten before it is read.

Loading…