Given two integers,
n
andk
, an alternating permutation is a permutation of the firstn
positive integers such that no two adjacent elements are both odd or both even.Return the k-th alternating permutation sorted in lexicographical order. If there are fewer than
k
valid alternating permutations, return an empty list.
c++
1 | class Solution { |