Variable Sized Arrays

Sort by

recency

|

1437 Discussions

|

  • + 0 comments
    int n;
    cin>>n;
    int q;
    cin>>q;
    vector<vector<int>> arr(n);
    for(int i=0;i<n;i++)
    {
        int size;
        cin>>size;
        for(int j=0;j<size;j++)
        {
            int num;
            cin>>num;
            arr[i].push_back(num);
        }
    }
    for(int i=0;i<q;i++)
    {
        int a,b;
        cin>>a>>b;
        cout<<arr[a][b]<<endl;
    }
    
  • + 1 comment

    this has to be the worst worded question ever written.

  • + 0 comments

    the question is not clear.

  • + 0 comments

    int n,q; cin>>n>>q; vector> arr(n); for (int i=0;i>size; arr[i].resize(size); for (int j=0; j>arr[i][j]; } } while (q--) { int x,y; cin>>x>>y; cout<

  • + 0 comments

    Hackerrank should hire people who can at least formulate the problem properly so other people could understand it.