Problem Submissions Solution

Missing And Repeating

Difficulty: Easy

Acceptance: %

Points: 20.00

Given an unsorted array arr of positive integers. One number a from the set [1, 2,....,n] is missing and one number b occurs twice in the array. Find numbers a and b.

Note: The test cases are generated such that there always exists one missing and one repeating number within the range [1,n].

Topics

Companies

Articles

Examples:

Expected Time Complexity: O(n)

Expected Space Complexity: O(1)

Constraints:
  • 2 <= arr.size() <= 10^6
  • 1 <= arr[i] <= arr.size()
Companies:
Samsung Walmart TCS Infosys
Topics:
Array
Locked Content
Access Restricted: Please Login to access the code editor and test cases.