Ruby O(k)
Intuition\nNot sure why this is labelled as a medium.\n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time complexity: O(k)\n
# Intuition\nNot sure why this is labelled as a medium.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(k)\n\n- Space complexity: O(k)\n\n# Code\n```\n# @param {Integer[]} nums\n# @param {Integer} limit\n# @param {Integer} goal\n# @return {Integer}\ndef min_elements(nums, limit, goal)\n    sum = nums.sum\n    difference = goal - sum\n\n    return 0 if difference == 0\n\n    return 1 if difference.abs <= limit\n\n    (difference.abs / limit) +  [(difference.abs % limit), 1].min\n\nend\n```
['Ruby']