Given an array of integers, return a new array such that each element at index i of the new array is the product of all the numbers in the original array except the one at i. For example, if our input was [1, 2, 3, 4, 51, the expected output would be [120, 60, 40, 30, 24]. If our input was [3, 2, 11, the expected output would be [2, 3, 6]. Follow-up: What if you can't use division?
Given an array of integers, return a new array such that each element at index i of the new array is the product of all the numbers in the original array except the one at i. For example, if our input was [1, 2, 3, 4, 51, the expected output would be [120, 60, 40, 30, 24]. If our input was [3, 2, 11, the expected output would be [2, 3, 6]. Follow-up: What if you can't use division?
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 24PE
Related questions
Question
In c++
![Given an array of integers, return a new array such that each element at index i of
the new array is the product of all the numbers in the original array except the one
at i.
For example, if our input was [1, 2, 3, 4, 51, the expected output would be [120,
60, 40, 30, 24]. If our input was [3, 2, 11, the expected output would be [2,
3,
6].
Follow-up: What if you can't use division?](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5e32e9a1-838f-4a11-a35f-9422af97c513%2F9ff0c629-2a17-472a-a5f5-c11e6ee4c51e%2Fox3a6t_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Given an array of integers, return a new array such that each element at index i of
the new array is the product of all the numbers in the original array except the one
at i.
For example, if our input was [1, 2, 3, 4, 51, the expected output would be [120,
60, 40, 30, 24]. If our input was [3, 2, 11, the expected output would be [2,
3,
6].
Follow-up: What if you can't use division?
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning