Hacker News new | ask | show | jobs
by revskill 531 days ago
Is it useful in solving leetcode problems ?
2 comments

Dynamic programming is often (always?) structured as a monoid, and that's the kind of thing that shows up in leetcode.
Can you elaborate or point to resources?
I did a quick search and found this:

https://aclanthology.org/C08-5001.pdf

Also good was section 4 of

https://par.nsf.gov/servlets/purl/10237543

Both work with semirings, which are a structure with two monoids.

I found these papers fairly readable on a quick skim, but I have a background in closely related stuff. They might not be so readable if you're not used to the style of presentation.

years ago, i solved plenty of HackerRank problems in Haskell with code that contained "instance Monoid ... where" :)