2965. Find Missing and Repeated Values
You are given a 0-indexed 2D integer matrix
grid
of sizen * n
with values in the range[1, n2]
. Each integer appears exactly once excepta
which appears twice andb
which is missing. The task is to find the repeating and missing numbersa
andb
.Return a 0-indexed integer array
ans
of size2
whereans[0]
equals toa
andans[1]
equals tob
.
1 | class Solution { |