Link:
Track: Amazon Tag
Question
Restate
Edge Case
Method 1
Method 2
Method
Approach
(discussed at lease two approach?)
Complexity
- Time Complexity:
- Space Complexity:
Code
class Solution:
def findMissingAndRepeatedValues(self, grid: List[List[int]]) -> List[int]:
rows = len(grid)
cols = len(grid[0])
total = rows * cols
seen = set()
for r in range(rows):
for c in range(cols):
val = grid[r][c]
if val in seen:
dup = val
seen.add(val)
for val in range(1, total + 1):
if val not in seen:
miss = val
return [dup, miss]History
- Jan-xx-2026 Peeked