Add array tally for ruby

This commit is contained in:
Wilfried OLLIVIER 2023-07-16 15:11:53 +02:00
parent 2b242e2254
commit 75a9e9cf02

View file

@ -12,3 +12,10 @@ puts true if arr.uniq.length == 1
```ruby ```ruby
(subarray & array) == array (subarray & array) == array
``` ```
## Compute values occurences
```ruby
[1, 1, 2, 3, 4, 5, 5, 5, 5].tally
=> {1=>2, 2=>1, 3=>1, 4=>1, 5=>4}
```