Skip to main content

Posts

Featured

Programming Practice challenge : Fredo and Array Update

   Programming Practice challenge Fredo and Array Update             Hacker Earth Problem.      Problem: Fredo and Array Update Max. score: 100 Fredo is assigned a new task today. He is given an array  A  containing  N  integers. His task is to update all elements of array to some minimum value  x  , that is,  A [ i ] = x  ;  1 ≤ i ≤ N  such that sum of this new array is strictly greater than the sum of the initial array. Note that  x  should be as minimum as possible such that sum of the new array is greater than the sum of the initial array. Input Format : First line of input consists of an integer  N  denoting the number of elements in the array  A . Second line consists of  N  space separated integers denoting the array elements. Output Format : The only line of output consists of the value of  x . Input Constraints : 1 ≤ N ≤ 10 5 1 ≤ ...

Latest Posts