Sign in
Log inSign up

Array Problem In Javascript

Default profile photo
Anonymous
·Mar 22, 2018

given an array of integers, return an output array such that output[i] is equal to the product of all the elements in the array other than itself

for example :

var firstArray = [2, 2, 4, 1]; // o/p: [8, 8, 4, 16] var secondArray = [0, 0, 0, 2];o/p: [0, 0,0,0] var thirdArray = [-2, -2, -3, 2]; 0/P: [12, 12, 8, -12]

What should be the approach for this kind of problem?

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct