BackmediumArrays Swiggy

Galactic Expedition Data Processor Solution

Problem Statement

In a galactic expedition, space explorers collect data on celestial body temperatures from two separate modules. The temperature readings are stored in two unsorted arrays. Write a function that sorts these temperature readings using quick sort and then merges them into a single sorted array, ensuring that duplicate temperatures are preserved.

Example 1
Input
[13, 13, 17, 17, 22, 22, 31, 31, 36, 36, 42, 42, 45, 45, 58, 58]
Output
[13, 13, 17, 17, 22, 22, 31, 31, 36, 36, 42, 42, 45, 45, 58, 58]

Explanation: Step-by-step: First, we sort the two input arrays using quicksort. Then, we merge the two sorted arrays into a single array, preserving duplicate temperatures.

Example 2
Input
[11, 11, 22, 22, 39, 39, 49, 49, 76, 76, 85, 85, 91, 91, 98, 98]
Output
[11, 11, 22, 22, 39, 39, 49, 49, 76, 76, 85, 85, 91, 91, 98, 98]

Explanation: Step-by-step: First, we sort the two input arrays using quicksort. Then, we merge the two sorted arrays into a single array, preserving duplicate temperatures.

Constraints

  • The input arrays can have duplicate temperature readings.
  • The total number of elements in both input arrays is between 2 and 1000.
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free