Given a sequence of numeric codes representing asteroid positions and a specified number of cosmic events, determine the lexicographically smallest sequence after applying these events. The 'pulsar' event sorts the array in ascending order, and the 'blackhole' event multiplies each element by -1.
Explanation: Step 1: Apply the 'pulsar' event. Since the input array is already sorted in ascending order, the 'pulsar' event does not change the array. The output remains the same: [-12, -8, -5, -3]. Step 2: Apply the 'blackhole' event. Each element in the array is multiplied by -1. The output becomes: [12, 8, 5, 3].
Explanation: Step 1: Apply the 'blackhole' event. Each element in the array is multiplied by -1. The output becomes: [-14, -9, -7, -2]. Step 2: Apply the 'pulsar' event. The array is sorted in ascending order. The output remains the same: [-14, -9, -7, -2].
Master coding challenges related to Arrays and solve the [Backup] Galactic Transmission problem optimally.
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak