Post History
JavaScript (Node.js), 34 29 26 bytes -5 bytes thanks to Shaggy's suggestion on a similar challenge -3 bytes again thanks to Shaggy! a=>a.map(d=v=>d[v]=-~d[v]) Try it online!
Answer
#5: Post edited
# [JavaScript (Node.js)], ~~34~~ ~~29~~ ~~26~~ bytes- *-5 bytes thanks to Shaggy's suggestion on [a similar challenge](https://codegolf.codidact.com/posts/286630/286632#answer-286632)*
- *-3 bytes again thanks to Shaggy!*
- ```javascript
- a=>a.map(d=v=>d[v]=-~d[v])
- ```
- [Try it online!][TIO-krjjbgjq]
- [JavaScript (Node.js)]: https://nodejs.org
[TIO-krjjbgjq]: https://tio.run/##JYxBCoMwFETX5hR/V4Nfwaa1FIkXkSyCJqUlNWKCG7FXT2NkmBmYgfeRq3TD8p59OdlRBc2D5J2svnLOV96N/Sp4@TsKR77tNAx2ch68ct4Bh55kfY01XpPqJIZMYNwZPvCON3zGh0U32AgiWkK0XSA36qSA1SeNwkayg26Nqox95ekt4AJlF6MAnRZKW7KHPw "JavaScript (Node.js) – Try It Online"
- # [JavaScript (Node.js)], ~~34~~ ~~29~~ 26 bytes
- *-5 bytes thanks to Shaggy's suggestion on [a similar challenge](https://codegolf.codidact.com/posts/286630/286632#answer-286632)*
- *-3 bytes again thanks to Shaggy!*
- ```javascript
- a=>a.map(d=v=>d[v]=-~d[v])
- ```
- [Try it online!][TIO-krjjbgjq]
- [JavaScript (Node.js)]: https://nodejs.org
- [TIO-krjjbgjq]: https://tio.run/##JYxBCoMwFETX5hR/V4Nfwaa1FIkXCVkETUqLNWJCNqW9ehojw8zADLyXCsqN23P19WInHQ2Pig@qeau1nHjgwySC5PVvLxpHuzgPXjvvgIMghWixxXNWm8WQSUw7wxte8YL39LDkDjtJZE@IsRuUsz4oYM1Bo/AhxU63s25m@yjzW8EJ6iFFBSYvlPbkG/8 "JavaScript (Node.js) – Try It Online"
#4: Post edited
# [JavaScript (Node.js)], ~~34~~ 29 bytes- *-5 bytes thanks to Shaggy's suggestion on [a similar challenge](https://codegolf.codidact.com/posts/286630/286632#answer-286632)*
- ```javascript
a=>a.map(v=>d[v]=-~d[v],d={})- ```
- [Try it online!][TIO-krjjbgjq]
- [JavaScript (Node.js)]: https://nodejs.org
- [TIO-krjjbgjq]: https://tio.run/##JYxBCoMwFETX5hR/V4Nfwaa1FIkXkSyCJqUlNWKCG7FXT2NkmBmYgfeRq3TD8p59OdlRBc2D5J2svnLOV96N/Sp4@TsKR77tNAx2ch68ct4Bh55kfY01XpPqJIZMYNwZPvCON3zGh0U32AgiWkK0XSA36qSA1SeNwkayg26Nqox95ekt4AJlF6MAnRZKW7KHPw "JavaScript (Node.js) – Try It Online"
- # [JavaScript (Node.js)], ~~34~~ ~~29~~ ~~26~~ bytes
- *-5 bytes thanks to Shaggy's suggestion on [a similar challenge](https://codegolf.codidact.com/posts/286630/286632#answer-286632)*
- *-3 bytes again thanks to Shaggy!*
- ```javascript
- a=>a.map(d=v=>d[v]=-~d[v])
- ```
- [Try it online!][TIO-krjjbgjq]
- [JavaScript (Node.js)]: https://nodejs.org
- [TIO-krjjbgjq]: https://tio.run/##JYxBCoMwFETX5hR/V4Nfwaa1FIkXkSyCJqUlNWKCG7FXT2NkmBmYgfeRq3TD8p59OdlRBc2D5J2svnLOV96N/Sp4@TsKR77tNAx2ch68ct4Bh55kfY01XpPqJIZMYNwZPvCON3zGh0U32AgiWkK0XSA36qSA1SeNwkayg26Nqox95ekt4AJlF6MAnRZKW7KHPw "JavaScript (Node.js) – Try It Online"
#3: Post edited
- # [JavaScript (Node.js)], ~~34~~ 29 bytes
*-6 bytes thanks to Shaggy's suggestion on [a similar challenge](https://codegolf.codidact.com/posts/286630/286632#answer-286632)*- ```javascript
- a=>a.map(v=>d[v]=-~d[v],d={})
- ```
- [Try it online!][TIO-krjjbgjq]
- [JavaScript (Node.js)]: https://nodejs.org
- [TIO-krjjbgjq]: https://tio.run/##JYxBCoMwFETX5hR/V4Nfwaa1FIkXkSyCJqUlNWKCG7FXT2NkmBmYgfeRq3TD8p59OdlRBc2D5J2svnLOV96N/Sp4@TsKR77tNAx2ch68ct4Bh55kfY01XpPqJIZMYNwZPvCON3zGh0U32AgiWkK0XSA36qSA1SeNwkayg26Nqox95ekt4AJlF6MAnRZKW7KHPw "JavaScript (Node.js) – Try It Online"
- # [JavaScript (Node.js)], ~~34~~ 29 bytes
- *-5 bytes thanks to Shaggy's suggestion on [a similar challenge](https://codegolf.codidact.com/posts/286630/286632#answer-286632)*
- ```javascript
- a=>a.map(v=>d[v]=-~d[v],d={})
- ```
- [Try it online!][TIO-krjjbgjq]
- [JavaScript (Node.js)]: https://nodejs.org
- [TIO-krjjbgjq]: https://tio.run/##JYxBCoMwFETX5hR/V4Nfwaa1FIkXkSyCJqUlNWKCG7FXT2NkmBmYgfeRq3TD8p59OdlRBc2D5J2svnLOV96N/Sp4@TsKR77tNAx2ch68ct4Bh55kfY01XpPqJIZMYNwZPvCON3zGh0U32AgiWkK0XSA36qSA1SeNwkayg26Nqox95ekt4AJlF6MAnRZKW7KHPw "JavaScript (Node.js) – Try It Online"
#2: Post edited
# [JavaScript (Node.js)], 34 bytes- ```javascript
(a,d={})=>a.map(v=>d[v]=1+d[v]||1)- ```
- [Try it online!][TIO-krjjbgjq]
- [JavaScript (Node.js)]: https://nodejs.org
[TIO-krjjbgjq]: https://tio.run/##JYxBCoMwFETXzSn@rgl@hTStpUi8iGQRNCkt1ogJbtSzp1EZZgZm4H31rH07fcaQD64z0cpINXZy2ZisdfHTI51l3TWzkjzba105i60bfIBgfPAgoSGXhiPH2yF@SKBQmHaBT3zgHV/pEcklloqoihDrJqC9OSng7EljsJDLTne9KXr3psebwRXyOkUG9lgYq8gW/w "JavaScript (Node.js) – Try It Online"
- # [JavaScript (Node.js)], ~~34~~ 29 bytes
- *-6 bytes thanks to Shaggy's suggestion on [a similar challenge](https://codegolf.codidact.com/posts/286630/286632#answer-286632)*
- ```javascript
- a=>a.map(v=>d[v]=-~d[v],d={})
- ```
- [Try it online!][TIO-krjjbgjq]
- [JavaScript (Node.js)]: https://nodejs.org
- [TIO-krjjbgjq]: https://tio.run/##JYxBCoMwFETX5hR/V4Nfwaa1FIkXkSyCJqUlNWKCG7FXT2NkmBmYgfeRq3TD8p59OdlRBc2D5J2svnLOV96N/Sp4@TsKR77tNAx2ch68ct4Bh55kfY01XpPqJIZMYNwZPvCON3zGh0U32AgiWkK0XSA36qSA1SeNwkayg26Nqox95ekt4AJlF6MAnRZKW7KHPw "JavaScript (Node.js) – Try It Online"
#1: Initial revision
# [JavaScript (Node.js)], 34 bytes ```javascript (a,d={})=>a.map(v=>d[v]=1+d[v]||1) ``` [Try it online!][TIO-krjjbgjq] [JavaScript (Node.js)]: https://nodejs.org [TIO-krjjbgjq]: https://tio.run/##JYxBCoMwFETXzSn@rgl@hTStpUi8iGQRNCkt1ogJbtSzp1EZZgZm4H31rH07fcaQD64z0cpINXZy2ZisdfHTI51l3TWzkjzba105i60bfIBgfPAgoSGXhiPH2yF@SKBQmHaBT3zgHV/pEcklloqoihDrJqC9OSng7EljsJDLTne9KXr3psebwRXyOkUG9lgYq8gW/w "JavaScript (Node.js) – Try It Online"