3 ms·
It would be incredibly helpful to have tips for solving leetcode problems in a functional way. There seems to be a category of problems that are most convenient
by sbussard 6y ago
It would be incredibly helpful to have tips for solving leetcode problems in a functional way. There seems to be a category of problems that are most conveniently/efficiently solved using mutation, though I'm personally not a fan.
- Jtsummers 6y agoI've never actually looked at leetcode problems, can you give examples of ones that seem to be best done using mutation?
- sbussard 6y agoOff the top of my head I can only think of the one where you need to merge two linked lists in sorted order. It seems like most fall into being iterative or recursive. The iterative solutions tend to involve mutations. Doing them functionally seems like a bit of extra overhead. I'd love to be wrong about that because FP seems to be mathematically superior