Question: You have been given an array of size n ' containing the number of diamonds in each pouch. You also have the number of

You have been given an array of size "n' containing the number of diamonds in each pouch. You also have the number of trips 't required to transfer all the diamonds from the godown to the jewellery shop. It is necessary to maintain the order of the pouches in the array while transferring the diamonds. You cannot send more diamonds than the number of diamond boxes in one trip.Your task is to find the minimum number of damond boxes required to transfer all the diamonds from the godown to the jewellery shop in 't' trips. This means that on each trip, you will take as many diamonds as possible from the pouches but ago not more then the avilable number of diamond boxes. The order of the pouches in the array is important and must be maintained throughout the process.Constraints:9191406010501stsns 10431s arril 50Input FormatLine one takes the size of the array, and the next line takes elements of the given size.Next line number of trips. Output FormatA minimum number of Diamond Boxes.Testcase Input212222Testcase Output2Explanationmagendin.We can send diamonds in 2 trips with the minimum boxes required are 3In the following way:-trip 1>>1+2+3trip 2>>22Sample Testcase #1Testcase Input412344Testcase Output4Sample Teptcase iTestcase Input412344Testcase Output4ExplanationWe can send diamonds in 4 trips with minimum boxes required are 4In the following way.Trip 1>>1+1Trip 2=>>22Trip 3*>>33Trp 4>>>4+4
Code in python

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!