Whats wrong with this code....getting index out of bound exception

@Narasimha,
https://ide.codingblocks.com/s/221921 Corrected your code and highlighted the line where error was there.

do count -1 while setting index in arr. because size of arr is count and it will go out of bounds otherwise.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.