Guest User

Untitled

a guest
Feb 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. [1,1,1,1,2,2,2,3,3,3].inject([]) { |temp, int|
  2. if temp.last != nil && temp.last[0] == int
  3. temp[-1] = [int, temp.last[1] + 1]
  4. else
  5. temp << [int, 1]
  6. end
  7. temp
  8. }
Add Comment
Please, Sign In to add comment