CT001

Tikkiville Market Exchange

EasyAcceptance: 0.0%

In the bustling Tikkiville Market, each merchant's daily exchange value is calculated as the product of all other merchants' sales values. Given an array of integers representing each merchant's sales, return a new array where each element at index i is the product of all the numbers in the original array except the one at i. Follow-up: Can you solve this without using division?

Example 1:

Input: 5 1 2 3 4 5
Output: 120 60 40 30 24

Example 2:

Input: 3 3 2 1
Output: 2 3 6

Constraints:

1 <= n <= 100 -100 <= arr[i] <= 100 The product of all elements will fit in a 64-bit integer.

Tags:

arrays math
Loading...
Test Cases:No test cases
No test cases available.