7 in-place interview questions, asked at Google, Amazon, Microsoft and 3 more companies. Last asked Sep 2026.
Copy a rectangle within a 2D array in placeCodingGiven a 2D array, a rectangular block (top-left corner, height, width) and a destination for its top-left corner, copy the block to the destination with O(1) extra memory. The…
Last asked Sep 2026
First missing positiveCodingGiven an unsorted list of integers that may include negatives, zeros, duplicates and values much larger than the list's length, return the smallest positive integer that does not…
Last asked Sep 2026
Game of Life, updated in placeCodingEach cell of a grid is alive or dead, and all cells update together from the states of their eight neighbors, as in Conway's Game of Life. Compute the next state in place, without…
Update a grid of firing neuronsCodingA grid holds neurons that are either firing or not. In each step every neuron's next state depends on how many of its neighbours are firing, in the style of the Game of Life…
Last asked Feb 2026
Remove duplicates in place from an unsorted arrayCodingRemove repeated values from an unsorted array in place, keeping the first occurrence of each and their order, and return the new length. Compare a hash set with sorting first, and…
Last asked Feb 2026
Check an array is a permutation of 0 to n-1CodingImplement iszerobasedpermutation(nums: listint) - bool. Given an integer array nums of length n, return True if it contains every integer from 0 to n - 1 exactly once, and False…