Hackearth's Data Structures solutions( SnackDown Contest, Mark The Answer, Most Frequent ) :
Problem 16: SnackDown Contest Solution: (in c++) ( please guys before moving to the solution try it yourself at least 3-4 times , if you really wanna become a good coder) #include< bits/stdc++.h > using namespace std ; int main () { long long t ; cin >> t ; while ( t --) { long long n , p , q , i ; cin >> n ; cin >> p ; vector < long long > v1 ( p , 0 ); for ( i = 0 ; i < p ; i ++) { cin >> v1 [ i ]; } cin >> q ; vector < long long > v2 ( q , 0 ); for ( i = 0 ; i < q ; i ++) { cin >> v2 [ i ]; } vector < long long > v3 ( p + q ); merge ( v1 . begin (), v1 . end (), v2 . begin (), v2 . end (), v3 . begin ()); //vector v3=v1+v2 set < long long > s ( v3 . begin (), v3 . end ()); //converting vector v3 into set long