We were trying to remove max element and then minimizing n-1 elements by taking the max 2 elements.
sort. then make one indice to get till numbers greater than k.
from there you had to check whether the n-2nd element would be cut by how much by preceding elements when they are subtracted. This in turn affects how the last element should be treated. Basic logical question…
Give a link for the problem.
Please, care to elaborate properly, in depth.