Problem · Math
Alternating Parity Permutations
Learn this problemProblem statement
Consider the distinct integers from 1 through n. Count permutations in which every adjacent pair has different parity.
Function
countGoodPermutations(n: int) → longExamples
Example 1
n = 4return = 8Choose whether odd or even comes first, then independently order the two odd and two even values.
Constraints
1 <= n <= 11
More Atlassian problems
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024