Post History
Ruby, 36 bytes ->a{i=-1;a.map{a[0..i+=1].count _1}} Try it online! The code in the TIO link is 2 bytes longer because _n block parameter names are not supported on TIO's Ruby instance yet. ...
Answer
#1: Initial revision
# [Ruby], 36 bytes ```ruby ->a{i=-1;a.map{a[0..i+=1].count _1}} ``` [Try it online!][TIO-kron0uvq] The code in the TIO link is 2 bytes longer because `_n` block parameter names are not supported on TIO's Ruby instance yet. It will work the same, however. The code is: ```ruby ->a{i=-1;a.map{a[0..i+=1].count a[i]}} ``` [Ruby]: https://www.ruby-lang.org/ [TIO-kron0uvq]: https://tio.run/##TU67CgIxEOzvKxZtFNdg7nygEsFGECwEyyNF1BwG1Mg9Con59nMTEWUIzM7sTLZsjs@2EO1wpZwRQ75U7KYeTuUjxsxAcMlOtrnXoHIjvW9rXdUVCHAJQM6RYxrBIzLMJIhVMNJokYBjnAQuMSQynNE4xnk0U5zi9Jv44VOYysQn8Tum1ekCZwsvg2Bf1FPSBQXrmT7xR0MHdbrOeAhN0HXWd0g3RVgTYIl/t/brwyF4@lrpP3mz3u4WIVnGpL6fE3rtGw "Ruby – Try It Online"