Math, asked by sonicaponamma, 9 months ago

Find the maximum number of children among whom 970 Chocolates and 1067 Candies can be distributed in such a way that each child gets the same number of chocolates and candies.​

Answers

Answered by Hacker771
0

Answer:

Given n boxes containing some chocolates arranged in a row. There are k number of students. The problem is to distribute maximum number of chocolates equally among k students by selecting a consecutive sequence of boxes from the given lot. Consider the boxes are arranged in a row with numbers from 1 to n from left to right. We have to select a group of boxes which are in consecutive order that could provide maximum number of chocolates equally to all the k students. An array arr[] is given representing the row arrangement of the boxes and arr[i] represents number of chocolates in that box at position ‘i’.

Step-by-step explanation:

Input : arr[] = {2, 7, 6, 1, 4, 5}, k = 3

Output : 6

The subarray is {7, 6, 1, 4} with sum 18.

Equal distribution of 18 chocolates among

3 students is 6.

Note that the selected boxes are in consecutive order

with indexes {1, 2, 3, 4}.

Similar questions