Close
Topic list
Gary and multiplication
EASY
20 mins
Heap
Topics (Covered in this problem)
Problem solved
Skill meter
Heap
-
-
Other topics
Problem solved
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Gary and multiplication

Contributed by
Ashwani
Easy
0/40
Avg time to solve 20 mins
Success Rate 85 %
Share

## Problem Statement

#### Note: Two numbers can be the same value-wise but they should be distinct index-wise.

##### Example:
``````If the array is [2, 3, 3, 4], the answer should be:-

-1
-1
18 (3 * 3 * 2)
36 (4 * 3 * 3)
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample input 1:
``````1
4
2 3 1 4
``````
##### Sample output 1:
``````-1 -1 6 24
``````
##### Explanation
``````-1 (no second largest as well as third largest element is present)
-1 (no third largest element is present)
6 (3 * 2 * 1)
24 (4 * 3 * 2)
``````
##### Sample input 2:
``````1
6
1 5 7 3 9 12
``````
##### Sample output 2:
``````1 -1 35 105 315 756
``````
Auto
Console