+ 1

Help required for improving the solution

Palermo is planning to get the gold out of the Bank using the extraction pump. Due to some technical constraints the gold pallets that are melted into grains of varying weights can be transported only into some batches of grains. A batch can be formed only if the product of number of grains in that batch and the weight of minimum weighted grain of that batch is at least PP i.e the water pressure of the extraction Pump. You are given the total number of grains N ,an array A of N integers containing the weights of the grains and a Pressure value P. Task is to calculate the maximum number of batches that can be formed satisfying the given condition. https://code.sololearn.com/cbwej4J5iqSS/?ref=app How can i improve the solution to complete all the test cases??

19th Dec 2021, 4:36 AM
sanjit jha
sanjit jha - avatar
1 Respuesta
+ 1
Declare I and J beforehand or Use two nested for loops.... Don't complicate an online compiler so much...... Machines do have their limitations too
25th Dec 2021, 11:09 AM
Aditya
Aditya - avatar