Rodrigo Girão Serrão 🐍🚀 @mathspp.com · Dec 2

Here's a lie developers tell themselves: “Recursion is useless” That's a coping mechanism because you're afraid of recursion... But you shouldn't be afraid! Recursion is actually nice ✨ And it's a very natural way to express certain algorithms... Let me show you an example.

0 likes 1 replies

?

Replies

Rodrigo Girão Serrão 🐍🚀 · Dec 2

Consider the permutations of the list `[0, 1, 2]`: [ (0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0), ] The first two results are `(0, 1, 2)` and `(0, 2, 1)`, right? Now, note how