Question: define funciton to find the maximum length possible by cutting N given sticks into at least K pieces. Given an arraystick[]of size N ,
define funciton to find the maximum length possible by cutting N given sticks into at least K pieces. \ Given an arraystick[]of sizeN, representing the length ofNpieces of stick and an integerK, at leastKpieces of the same length need to be cut from the given stick pieces. The task is to find the maximum possible length of these K stick pieces that can be obtained. \ \ Examples: \
Input: stick[] = {5, 9, 7}, K = 3 \ Output: 5 \
Explanation: \ Cut arr0= 5 = 5 \ Cut arr1= 9 = 5 + 4 \ Cut arr2= 5 = 5 + 2 \ Therefore, the maximum length that can be obtained by cutting the sticks into 3 pieces is 5.\
Input: stick[] = {5, 9, 7}, K = 4 \ Output: 4 \
Explanation: \ Cut arr0= 5 = 4 + 1 \ Cut arr1= 9 = 2 * 4 + 1 \ Cut arr2= 7 = 4 + 3 \ Therefore, the maximum length that can be obtained by cutting the sticks into 4 pieces is 4.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
