You are viewing a single comment's thread. Return to all comments →
Lua
function equalizeArray(arr) local max local elements = {} for _, value in ipairs(arr) do elements[value] = (elements[value] or 0) + 1 max = math.max(max or 0, elements[value]) end return #arr - max; end
Equalize the Array
You are viewing a single comment's thread. Return to all comments →
Lua