Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 958 Bytes

_2965. Find Missing and Repeated Values.md

File metadata and controls

36 lines (25 loc) · 958 Bytes

All prompts are owned by LeetCode. To view the prompt, click the title link above.

Back to top


First completed : March 06, 2025

Last updated : March 06, 2025


Related Topics : Array, Hash Table, Math, Matrix

Acceptance Rate : 84.01 %


Solutions

Python

class Solution:
    def findMissingAndRepeatedValues(self, grid: List[List[int]]) -> List[int]:
        cnt = Counter()
        for g in grid :
            cnt.update(g)

        return [[k for k, v in cnt.items() if v == 2][0],
                [x for x in range(1, len(grid) ** 2 + 1) if x not in cnt][0]]