Find Missing and Repeated Values

Easy · Arrays & Strings · about 10 minutes

Asked at Amazon, Google, Bloomberg, Microsoft, Meta.

An n × n grid holds the numbers 1..n², except that one value a appears twice and one value b is missing. Return [a, b].

Related guides