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
Define a function PrintFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. Ex: PrintF
DaniilM [7]

Answer:

The function declaration to this question as follows:

Function declaration:

//declaring method printFeetInchShort, that accepts two integer parameters

void printFeetInchShort(int numFeet,int numInches) //method

{//method body

printf("The given height is: "); // message printing

printf("%d\'%d\" ", numFeet,numInches); //value printing

}

Explanation:

In the above method (function) declaration a method "printFeetInchShort" is declared, that accepts two integer variable as its parameters.

  • This method uses a return type void, which means it will not return any value.  
  • The parameter "numFeet and numInches" accepts an integer value in the main method and inside the method, it will print its value by a single and double quote.
5 0
3 years ago
What are the differences and similarities of computer virus and biological virus. Give 4 examples
Papessa [141]

Answer:

During recent months, we’ve witnessed an unexpected and distressing pandemic of a coronavirus disease. What I find especially distressing about it is how the worldwide adversity was caused by just a tiny thing — namely, a virus called SARS-CoV-2.

However, biological viruses have always been a potent threat to humanity, as historic pandemics have proved. No wonder viruses became an ideal weapon model in a totally different world — a world of programming. The first computer viruses were created as early as in the 1970s. Starting as pranks, they evolved to become a major threat to the stability of computer networks worldwide. And the more I think of viruses, both biological and digital, the more amazed I am by their similarities.

We don’t know what kind of challenges viruses of either type will cause in the future, but understanding how they infect, the symptoms they induce, how they spread, and the damage they can cause can help us fight both.

The Common Thread

Let’s start with the basics: What does a virus look like?

computer virus of 1999

Click image for larger version

Figure 1: Pictured on the left is an electron microscope image of SARS-CoV-2 particles - the pandemic-causing coronavirus. Source: NIAID-RML. Pictured on the right is a code snippet of a Melissa, the notorious email-spreading computer virus of 1999. Source: Gizmodo.

The images in Figure 1 might look vastly different, but, essentially, they’re the same: a string of code. In the coronavirus, it’s the RNA genome in a shell; in Melissa, it’s computer code. In both cases, the code is an “instruction” for the virus to follow.

Explanation:

here is your answer hope you will enjoy

thank you

6 0
3 years ago
In G mail, when we want to write an email to multiple recipients in such a way that the recipients couldn't understand that we h
Inessa05 [86]

Answer:

Bcc

Explanation:

Every recipient email address you enter into the “to” and “cc” fields will be able to see each other. The email addresses you add to the “bcc” field will not be visible to the “to” and “cc” recipients or the other “bcc” recipients.

7 0
3 years ago
Read 2 more answers
On a Windows network share, if the user can add, edit, and delete files and folders within the LabFiles folder, what type of acc
Colt1911 [192]

Answer:

Modify

Explanation:

When people like your family or friends can access a computer, then the need to have permissions would certainly come in handy. There are six basic types of permission one can choose from and the modify option is one of them. It simply grants the holder the ability to read and write files and subfolders and also allows for the deletion of folders and files.

6 0
3 years ago
How can artificial intelligence be used in learning science?
tiny-mole [99]

Artificial intelligence can be used to help science students research and verify their research. It is also a very interesting topic to study in general.

Hope that helped!!! k

5 0
4 years ago
Other questions:
  • ____ takes the idea of breaking down a program into separate and reusable functions to the next level by focusing on the encapsu
    10·1 answer
  • What was Leonardo da Vinci an expert in
    11·1 answer
  • Do you think technology and social media have made it easier or more difficult to make connections and find a job? Explain.
    12·1 answer
  • Which of the following could be useful during system testing?
    6·1 answer
  • How do I upload a picture in python 3
    7·1 answer
  • When at the rightmost cell in a row, press the ENTER key to move to the first cell in the next row; do not press the TAB key.
    14·1 answer
  • Your mother wants to purchase a large hard drive for her computer ex you to see what type of dry interphase she has her computer
    11·1 answer
  • A look to different section of the same page is known as_____.
    7·1 answer
  • In computing, what does LAN stand for?​
    13·2 answers
  • Will creates an entry in his calendar and marks it as an all-day instance. Which item has he created?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!