Alternating Parity Permutations
Updated
Problem 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 Online Assessment questions
- 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
- Binary Search Tree IteratorOA · Seen Nov 2023
- Binary Tree Level Order TraversalOA · Seen Nov 2023
Similar questions at other companies
- Frog Paths Without Long RunsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Two Ranked Teams Meeting in a Random BracketOptiver · OAOptiver interview questions
- Count Distinct Arrays After Decrement OperationsBloomberg LP · OABloomberg LP interview questions
- Get Triplet CountIBM · OAIBM interview questions
- Count Fancy NumbersHudson River Trading · OAHudson River Trading interview questions
- Count Numbers with the Same Set-Bit CountMicrosoft · OAMicrosoft interview questions
- Count Reverse-Digit PairsVisa · OAVisa interview questions
- Get Triplet CountPoint72 · OAPoint72 interview questions
- Count Shipment SchedulesMorgan Stanley · OAMorgan Stanley interview questions
- Color a Grid with No Monochromatic Row or ColumnIntuit · OAIntuit interview questions