One number in the array appears twice, while another number from the range [1, n] is missing. Our task is to find both: Repeating Number (A) Missing Number (B) Example Input: nums = [ 1 , 2 , 2 , 4 ] Output: [ 2 , 3 ] Here, 2 appears twice and 3 is missing. Brute Force Approach Intuition For every number from 1 to n , count how many times it appears in the array. If frequency is 2 , it is the repeating number. If frequency is 0 , it is the missing number. Time & Space Complexity Time Complexity: