1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
GenaCL600 [577]
3 years ago
12

The input nums is supposed to be an array of unique integers ranging from 1 to nums.length (inclusive). However, there is a mist

ake: one of the numbers in the array is duplicated, which means another number is missing. Find and return the sum of the duplicated number and the missing number. Example: in the array [4, 3, 3, 1], 3 is present twice and 2 is missing, so 3 2
Computers and Technology
1 answer:
Elden [556K]3 years ago
6 0

The program is an illustration of loops.

Loops are used to perform repetitive and iterative operations.

The program in Python where comments are used to explain each line is as follows:

#This intializes the list

nums = [5,4,4,2,1]

#This gets the length of the list

size = len(nums)

#This iterates through the list

for i in range(size):

   #The following if condition determines the repeating number

   if nums[abs(nums[i])-1] > 0:

       nums[abs(nums[i])-1] = -nums[abs(nums[i])-1]

   else:

       repeating = abs(nums[i])

   #The following if condition determines the missing number

   if nums[i]>0:

       missing = i + 1

   

#This calculates and prints the sum of the missing and the repeating numbers

print(repeating+missing)

Read more about similar programs at:

brainly.com/question/13549861

You might be interested in
I need help also this counts as my second giveaway and last for today
kifflom [539]

Answer:

I am pretty sure its the Visual card

8 0
3 years ago
Read 2 more answers
Which arrangement shows the strongest gravitational effects of the sun and moon on the earth's tides?
julia-pushkina [17]
C rain tides is right
3 0
3 years ago
Is the intersection of a column and a row
Alex17521 [72]

A Cell hope you enjoy your answer

3 0
2 years ago
How many survey monkey devices are you allowed to have for each user
svp [43]

Answer:

(Hope this helps can I pls have brainlist (crown) ☺️)

Explanation:

Per account, you can verify up to two devices at once. The removal of a recognized device and the addition of a new one counts against your removal limit. You can only log in from the two most recent confirmed devices if you hit the removal limit.

3 0
3 years ago
You've finished programming the app! Now your company has to decide whether to use an open source
pishuonlain [190]

Answer:

Proprietary License gives you full ownership and trademark/patent opportunites. Open source allows for code donation and a community based development for your app. Generally speaking, if your a private entity creating an app for a client, you'll need the Proprietary Licence, which will allow you to sell the codebase to your client.

If your creating an app for your company as itself, you go either way, sell the license in licensing agreements, or have your companies community contribute and better your app from the inside.

Its entirely based on the agreements you set for the app.

5 0
3 years ago
Other questions:
  • Tags that provide browsers with information about document characteristics
    15·1 answer
  • Below is a sequence of 32-bit memory address references observed during the execution of an application, and given as word addre
    7·1 answer
  • Briefly explain five measures you have undertaken to protect your confidential
    12·1 answer
  • Dave has to create animations for a game. Which tool can Dave use?
    6·1 answer
  • Community gardens are public gardens where local residents can grow plants in a plot. They are very popular, so there are often
    7·1 answer
  • Which of the following activities would be best-suited for a thinking mind map?
    10·2 answers
  • Which kind of image is indispensable and needs added text to go with ?
    12·1 answer
  • . . ........Sad + sad= very sad
    7·2 answers
  • Plz plz plz help me with me
    14·2 answers
  • Which hardware component interprets and carries out the instructions contained in the software.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!