Merge Sorted Arrays Time : O(nlogk) Space : O(k) 123456789101112131415161718using namespace std;vector<int> mergeSortedArrays(vector<vector<int>> arrays) { priority_queue<array<int,3>, vector<array<int,3>>, greater<array<int,3>>> pq; vector<int> res; for(int i = 0; i < arrays.size(); i++) { if(arrays[i].empty()) continue; pq.push({arrays[i][0], i, 1}); } while(!pq.empty()) { auto [v, id, idx] = pq.top(); pq.pop(); res.push_back(v); if(arrays[id].size() != idx) pq.push({arrays[id][idx], id, idx + 1}); } return res;}