# Generate an N-length array having maximum element minimized and sum of array elements divisible by K

Generate an N-length array having maximum element minimized and sum of array elements divisible by KGiven two positive integers N and K, the task is to minimize the maximum element of the array formed such that the sum of array elements is positive and divisible by K.Examples:Input: N = 4, K = 50Output: 13Explanation The generated array is {12, 13, 12, 13}. Sum of the array is 50, which is divisible by K (= 50). Maximum element present in the array is 13, which is minimum possible.Input: N = 3, K = 3Output: 1Approach: The given problem can be solved on the basis of the following observations:From the above observations, the minimized maximum value of the constructed array is the ceil value of (K/N).Below is the implementation of the above approach:C++ #include using namespace std; int minimumValue(int N, int K){ return ceil((double)K / (double)N);} int main(){ int N = 4, K = 50; cout