Given two integers N (always even) and X, the task is to find an array of numbers such that the sum of GCD of adjacent pairs (where each element is part of only one pair) is X. If no such array is possible return -1. If there are more than 1 possible sequence return any of them.
•2m read time• From geeksforgeeks.org
Sort: