Harry and magical number
CodeChefOpen on judge ↗
Harry and Hermione are playing a game in which Hermione challenges Harry by giving an array A and a number S, and asks to provide an efficient magical algorithm to find a number K from array A such that if all elements in A greater than K are changed to K, the sum of all elements in the resulting array will be S. Now harry has to find that magical number K. So help out harry in this task. Inp
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start