Sobes.tech
Junior — Senior

Merging two sorted vectors into one

livecode

Task condition

Given two vectors sorted1 and sorted2, each already sorted in ascending order. The task is to merge their elements into a new vector while maintaining the sorted order.

std::vector<int> mergeArrays(std::vector<int> sorted1, std::vector<int> sorted2) {
    // merge two sorted arrays
}