Minimize Absolute Difference of Server Loads
Learn this problemProblem statement
There are some processes that need to be executed. Amount of a load that process causes on a server that runs it, is being represented by a single integer. Total load caused on a server is the sum of the loads of all the processes that run on that server. You have at your disposal two servers, on which mentioned processes can be run. Your goal is to distribute given processes between those two servers in the way that, absolute difference of their loads will be minimized.
Given an array of n integers, of which represents loads caused by successive processes, return the minimum absolute difference of server loads.
Function
minAbsDifference(loads: int[]) → int
Complete the function minAbsDifference in the editor.
minAbsDifference has the following parameter:
int[] loads: an array of integers representing the loads
Returns
int: the minimum absolute difference of server loads
Examples
Example 1
loads = [1, 2, 3, 4, 5]return = 1Constraints
Unknown yet. If you happen to know about it, feel free to lmk! TYSM ~3~