Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4571024
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:26:42+00:00 2026-05-21T19:26:42+00:00

This question is very similar to How to find a duplicate element in an

  • 0

This question is very similar to How to find a duplicate element in an array of shuffled consecutive integers?, but has some additional requirements.

You have a list of consecutive integers, in no particular order. There is no guarantee on the range of these integers or the number of elements in the list.

This list is missing one integer and contains a duplicate of another integer.

An example of such a list is {16, 12, 13, 17, 14, 13}; in this case, the missing integer is 15 and the duplicated is 13.

What is the most time-efficient way to find both of these numbers, taking into account both small and large data sets? Is there any solution with a better time complexity than O(n log n) that doesn’t choke on small data sets?

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T19:26:43+00:00Added an answer on May 21, 2026 at 7:26 pm

    Actually you can apply the idea from the referenced topic. But since you have two changes, you should measure two things.

    For example, measure sum of values and sum of squares and compare them with expected ones.
    If number A is duplicated and number B is missing, you will have:

    • sum – expected_sum=A-B
    • sum_of_squares – expected_sum_of_squares=A^2-B^2

    Having (A-B) and (A^2-B^2) you can get (A+B)=(A^2-B^2)/(A-B).

    Having (A+B) and (A-B) you can get A=(A+B)/2+(A-B)/2 and B=(A+B)/2-(A-B)/2

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My question popped up a very similar question, this one . But the accepted
I've been thinking of this question very long, but really couldn't find the answer
EDIT : this question is very similar to this one but it's more conceptual
I have a question very similar to this one but the answer does not
I found a question that was very similar to this one, but using features
Question is very similiar to this find duplicates but I'd like to find only
There is a question very similar to this but I wanted to ask it
This question is very similar (or almost identical) to In a non blocking socket
This question is very similar to an earlier question I asked ( This Question
My question is very similar to this question - Addin parameter for Oracle except

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.