Resources distribution to n elements algorithm to reduce the difference I came across a coding challenge on the internet the question is listed below: