Solution of 'Variable Sized Arrays' (HackerRank)

 Hi guys, here's my solution of the question-'Variable Sized Arrays' from HackerRank. Again, if you guys have any doubts regarding my code, any suggestions for my code or blog, do comment below. TY and Happy Coding!

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n,q;
    cin>>n>>q;
    vector<intv[n];
    for(int i=0;i<n;i++){
        int Q;
        cin>>Q;
        for(int j=0;j<Q;j++){
            int x;
            cin>>x;
            v[i].push_back(x);
        }
    }
    while(q--){
        int i,t;
        cin>>i>>t;
        auto itr=v[i].begin()+t;
        cout<<*itr<<'\n';
    }
}

Comments

Popular posts from this blog

Solution of 'Tom Riddle's Diary' (Codeforces)

Solution to the problem 'Red Light, Green Light' from Codechef

Solution to the problem 'The Squid Game' form Codechef