one liner, sort + sliding window
Code\n\n# @param {Integer[]} nums\n# @param {Integer} k\n# @return {Integer}\ndef minimum_difference(nums, k)\n  return nums.sort.each_cons(k).map{|s| s.last-s.
# Code\n```\n# @param {Integer[]} nums\n# @param {Integer} k\n# @return {Integer}\ndef minimum_difference(nums, k)\n  return nums.sort.each_cons(k).map{|s| s.last-s.first}.min\nend\n\n```
['Sliding Window', 'Ruby']