Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def numbersGrouping(a)
- numbers = a.length
- groups = Array.new(100000)
- x = 0
- while (x < 100000)
- groups[x] = 0
- x = x + 1
- end
- x = 0
- while (x < a.length)
- y = a[x] / 10000
- if a[x] % 10000 == 0 then
- y = y - 1
- end
- if y < 1 then
- y = 0
- end
- groups[y] = 1
- x = x + 1
- end
- return groups.count(1) + numbers
- end
Add Comment
Please, Sign In to add comment