Practice: Product of All Numbers But This
A straightforward problem that, at first, seems daunting - until you break it down and apply the strategies you know.
Here's another practice question from Interview Cake, who kindly allowed me to use this other questions in this production.
Once again - I encourage you to do your best before watching all of the video. We can then try to solve it together!
Hereโs the question:
Write a function getProductsOfAllIntsExceptAtIndex() that takes an array of integers and returns an array of the products.
Starter code:
//Given...
[1, 7, 3, 4]
//Return
[84, 12, 28, 21]
//... in other words...
[7 * 3 * 4, 1 * 3 * 4, 1 * 7 * 4, 1 * 7 * 3]
Updated on Nov 14, 2025