1. Permutations:
You are given a list of distinct numbers and you're asked to find all the possible unique arrangements (or permutations) of those numbers.
Real-Life Example:
Think of arranging three different colored blocks:
Blocks: Red (1), Blue (2), Green (3).
We can arrange them as:
Red, Blue, Green
Red, Green, Blue
Blue, Red, Green, and so on...
2. Permutations II:
Same, but skip duplicates using sorting and checks. We use swapping for skip duplication.
Real-Life Example:
Think of arranging three different colored blocks:
Blocks: Red (1), Blue (2), Red (3).
We can arrange them as:
Red, Blue, Red
Red, Red, Blue
Blue, Red, Red, and so on...
Top comments (0)