Pls let me know what is wrong with this code

@Sunkumsav

  1. you cannot declare such a big array in stack memory image
    What the constraints are telling you is the range of the ELEMENTS, so you must use long long int datatype in this question.
  2. Array of size n has indices from [0, n-1] so the loop must stop BEFORE n. It should be i < n here image

this is the errror /bin/run.sh: line 4: 19 Segmentation fault (core dumped) ./exe

@Sunkumsav please make all the changes I mentioned above and it will work fine.


Your updated code in reference to corrections by @Ishitagambhir
Hit a like button if it works