HackerRank solution for Variable Sized Arrays In C++

Problem:- Variable Sized Arrays Solution Hacker Rank Solution or Variable Sized Arrays Solution hacker rank solution c++ orMulti Level Inheritance in java or Variable Sized Arrays Solution solution or Variable Sized Arrays Solution solution in C++ or Variable Sized Arrays Solution hacker rank solution in Java or Variable Sized Arrays Solution hacker rank solution c++ or Variable Sized Arrays Solution hacker rank solution c++ or Variable Sized Arrays Solution program in c or Variable Sized Arrays Solution solution in C or Hacker Rank Solution For Variable Sized Arrays Solution in C++ or Variable Sized Arrays Solution in C++ or Hacker Rank solution for Variable Sized Arrays Solution in C++.

Check- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard Domain.

Solution:-

#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
int n,q;
cin>>n>>q;
int** seq=new int* [n];
for(int i=0;i<n;i++)
{
int a;
cin>>a;
int* b=new int [a];
for(int j=0;j<a;j++)
{
int e;
cin>>e;
b[j]=e;
}
*(seq+i)=b;
}

for(int i=0;i<q;i++)
{
int r,s;
cin>>r>>s;
cout<<seq[r][s]<<endl;
}
}

Output:-

1. what is this line doing ??

--->*(seq+i)=b; <-----

2. Hello,

--->*(seq+i)=b; <----- I think this line is use for finding the sequence of the array. I find the simple solution of this problem check this one.

Solution

#include

using namespace std;

int main()
{
int n,q,k,i,j,a,b,data;

cin >> n >> q;

vector> array(n);

for(i=0;i> k;

for(j=0;j> data;
array[i].push_back(data);
}
}

for(i=0;i> a >> b;
cout << array[a][b];
cout<< endl;
}
}