3 ms·
I've never actually looked at leetcode problems, can you give examples of ones that seem to be best done using mutation?
by Jtsummers 7y ago
I've never actually looked at leetcode problems, can you give examples of ones that seem to be best done using mutation?
- sbussard 7y 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