LC 2965. Find Missing and Repeated Values
A concise tl;dr to speed up your coding interview prep
Find Missing and Repeated Values — Hash Map, with a math trick
Problem TL;DR
Given array of size n² with numbers 1 to n², find duplicated and missing number.
Solution TL;DR
Use a hash map as counter
Math trick using sum of squares and sum of AP