DSAEasyArraysHashing
Find the Duplicate Number in an Array
š Problem
Given an array of n+1 integers where each value is between 1 and n, find the one duplicate number.
š§ Approach
Use a hash set (or a boolean 'seen' array). Go through the array once ā for each number, check if it's already in the set. If yes, that's your duplicate. If no, add it to the set and continue. This avoids the O(n²) cost of comparing every pair.