Product Array (Array Series #5)
Description:
Introduction and Warm-up (Highly recommended)
Playing With Lists/Arrays Series
Task
Given an array/list [] of integers , Construct a product array Of same size Such That prod[i] is equal to The Product of all the elements of Arr[] except Arr[i].
Notes
Array/list size is at least 2 .
Array/list's numbers Will be only Positives
Repetition of numbers in the array/list could occur.
Input >> Output Examples
productArray ({12,20}) ==> return {20,12}
Explanation:
The first element in prod [] array 20 is the product of all array's elements except the first element
The second element 12 is the product of all array's elements except the second element .
productArray ({1,5,2}) ==> return {10,2,5}
Explanation:
The first element 10 is the product of all array's elements except the first element 1
The second element 2 is the product of all array's elements except the second element 5
The Third element 5 is the product of all array's elements except the Third element 2.
productArray ({10,3,5,6,2}) return ==> {180,600,360,300,900}
Explanation:
The first element 180 is the product of all array's elements except the first element 10
The second element 600 is the product of all array's elements except the second element 3
The Third element 360 is the product of all array's elements except the third element 5
The Fourth element 300 is the product of all array's elements except the fourth element 6
Finally ,The Fifth element 900 is the product of all array's elements except the fifth element 2
A more challenging version of this kata by Firefly2002
Playing with Numbers Series
Playing With Lists/Arrays Series
For More Enjoyable Katas
ALL translations are welcomed
Enjoy Learning !!
Zizou
Similar Kata:
Stats:
Created | Feb 23, 2018 |
Published | Feb 23, 2018 |
Warriors Trained | 18314 |
Total Skips | 939 |
Total Code Submissions | 24106 |
Total Times Completed | 10242 |
C++ Completions | 795 |
Ruby Completions | 246 |
JavaScript Completions | 3745 |
Crystal Completions | 23 |
Python Completions | 2795 |
NASM Completions | 15 |
Fortran Completions | 20 |
C Completions | 265 |
Java Completions | 1094 |
C# Completions | 524 |
Haskell Completions | 114 |
PHP Completions | 286 |
Dart Completions | 283 |
Julia Completions | 22 |
CoffeeScript Completions | 14 |
TypeScript Completions | 277 |
Reason Completions | 5 |
Elixir Completions | 54 |
Prolog Completions | 28 |
Clojure Completions | 36 |
Rust Completions | 217 |
COBOL Completions | 15 |
R Completions | 33 |
D Completions | 11 |
Total Stars | 185 |
% of votes with a positive feedback rating | 92% of 1319 |
Total "Very Satisfied" Votes | 1142 |
Total "Somewhat Satisfied" Votes | 145 |
Total "Not Satisfied" Votes | 32 |
Total Rank Assessments | 9 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |