defpair_difference(lst)lst.sort# sort array.combination(2)# get all posible combinations of pairs.select{|arr|(arr.max-arr.min)==2}# only combinations that have difference of 2.sort_by{|arr|arr[0]}# sort by the first numberend
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Ruby solution