Unknown error in coding block oline ide

terminate called after throwing an instance of ‘std::bad_alloc’
what(): std::bad_alloc
/bin/run.sh: line 4: 18 Aborted (core dumped) ./exe

Hey @ashish_arora369,
You were declaring the dynamically allocated array of size N before taking the input N .
You have to first take the input N and then declare the dynamically allocated array .
Like this :

Hope it helps!
Happy Coding! :blush:

Hey @ashish_arora369
What is the issue ??

input n before declaring dynamically

cin>>N;
int *arr=new int[N];