Marks :10
: 9 | : 0
You are given 'n' piggy banks, indexed from 0 to n - 1. Each piggy bank contains some amount of money in it which is represented by an array 'nums': You are asked to break all the piggy banks in any order. If you break the ith piggy bank, you will get the amount equivalent to (nums[i-1]* nums[i] * nums[i+1] dollars. If i-1 or i+1 goes out of bounds of the array, then treat it as if there is a piggy bank with 1 US Dollar in it. The goal is to return the maximum amount of dollars.
Constraints: 1 < 1<= 300 0 <= nums(i] <= 100 where i is [0, n-1]
First line contains n, the number of piggy banks. Second line contains an array nums representing the amount of money in each piggy bank.
An integer representing maximum amount of money
4 3 1 5 8
167
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.