Your solution will work in O((size11size12)+(size21size22)) value of this will be more than 10^8… So use sorting on all 4 arrays first and reduce complexity… Or use map to reduce complexity
Your solution will work in O((size11size12)+(size21size22)) value of this will be more than 10^8… So use sorting on all 4 arrays first and reduce complexity… Or use map to reduce complexity