Find The Missing Number
Problem Statement:
You are given an array containing n - 1 integers. These integers will range from 1 to n; if ordered, they will be sequential (try to solve the challenge without sorting the numbers). No duplicates are in the list, and one integer from the range is missing. Your task is to make a solution that finds the missing integer within the provided constraints.
Examples: Input: [3, 7, 1, 2, 8, 4, 5] Output: 6 Explanation: The array should contain integers from 1 to 8, but 6 is missing.
Input: [11, 2, 10, 4, 5, 6, 7, 8, 1, 9] Output: 3 Explanation: The array should contain integers from 1 to 11, but 3 is missing.
Input: [4, 3, 1, 5] Output: 2 Explanation: The array should contain integers from 1 to 5. In this sequence, the number 2 is missing.
Constraints: The array has n - 1 integers, where n is the upper limit of the range of integers. n <= 10,000 All elements in the array are distinct. The array elements are in no particular order. You should aim for an efficient solution. The solution should not rely on sorting the array. Do not use built-in functions that directly solve the problem (e.g., in Python, avoid using sum(arr) directly).
📤 Submission Guidelines
You can either email me your submission or Fork the Repository.
To submit using the GitHub repository, you must fork the challenge repository and create a Pull Request with your solution.
Code Your Solution: In your chosen high-performance language. Remember, efficiency is key!
Naming Convention: Name your solution file using the following convention: <your_name>_solution.* (replace <your_name> with your actual name and * with the appropriate file extension for your language).
All merge requests will remain open and un-merged until Monday morning.
🏆 Winner Selection Criteria Correctness: Solutions must pass all provided test cases, proving their ability to effectively handle a wide range of input scenarios. Performance: Among the correct solutions, the crown will go to the one with the fastest execution time. Prepare to push the limits of efficiency! Code Elegance (Tiebreaker): In the event of a tie in execution time, the solution with fewer lines of code will be deemed superior, reflecting not only raw speed but also the elegance and readability of the code.
🕒 Submission Deadline: All email solutions or merge requests must be submitted by Sunday 23:59:45.