Array -target sum pairs doubt

How to solve the runtime error

@Prats hey pratyush sharma declare your array after taking input n to resolve runtime error

There are two errors in this, first you have to take the first loop i.e. of i to (i<N-1) or i=N-2.
and Second you have to first sort the array before matching the target.