Accepted on leetcode and here showing run errort for 1st

If it is accepted by leetcode, then I think that there are some faulty test cases on hackerblocks. I will report this to the staff. Your code is right.

I think I resolved your doubt. Can you please mark this as resolved now.

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.