Arrange prime and non-prime numbers in an array
Filed under Sirion
The question
Rearrange an array containing prime and non-prime numbers such that prime numbers stay at their original indices in descending order, and non-prime numbers stay at their indices in ascending order.
No write-up yet. Related questions below have one.
Related Sirion questions
Collected from public candidate posts and coding forums. Updated Nov 2026.