SUPW - Java RuntimeError

code link - https://ide.codingblocks.com/s/170214
works fine for the sample input but gives run error in 0.36 seconds any suggestions ?

See for the array size 1 , you are sending pos as 1 and checking for pos ==1 , return arr[1] , but array don’t have pos 1 because it is zero based indexing.
You can refer this for understanding -:

code https://ide.codingblocks.com/s/171085
I tried bottoms up approach this time can you tell me what’s wrong.
It is still giving run error.

Because answer can overflow int.

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.