- Arrays, Binary Search, Searching

Minimum value of X such that sum of arr[i] – X raised to the power of brr[i] is less than or equal to K

Given an array arr[] and brr[] both consisting of N integers and a positive integer K, the task is to find the minimum value of X such that the sum of the maximum of (arr[i] – X, 0) raised to the power of brr[i] for all array elements (arr[i], brr[i]) is at most K.Examples:Input: arr[] = {2, 1, 4, 3, 5} brr[] = { 4, 3, 2, 3, 1}, K = 12  Output: 2Explanation:Consider the value of X as 2, then the value of the given expression is: => max(2 – 2, 0)4 + max(1 – 2, 0)3 + max(4 – 2, 0)2 + max(3 – 2, 0)3 +max(5 – 2, 0)1=> 04 + 03 + 22 + 13 + 31 = 8