QUIZ: CF_W19
◀ BACK WEEK 19
5 QUESTIONS
Q1 1 / 5 medium
Constructive Algorithms

Given an integer n, construct a permutation of [1, 2, ..., n] such that no two adjacent elements differ by exactly 1. Print -1 if impossible.

What is the key technique for constructive problems?