Skip to main content

Practice · 1 of 5

Count Permutations

CHALLENGE
Difficulty: beginner+25 XP

**Description:** Count the permutations of 1..n in which no two adjacent elements differ by more than 1... simplified for grading: count permutations of 1..n whose **first element is odd**. **Input:** One line: n (1 <= n <= 10). **Output:** One integer — the count. **Example:** 3 -> 4 (permutations starting with 1 or 3).

Back to lesson: Practice: Backtracking Problem Set