Help me out in this problem

@mr.encoder wait bro one it is still giving error in one case??

@mr.encoder [0,1,null,null,2,null,3,null,4]
3
0
it is giving error error in this case?

49 testcases are passed out of 56??

@mr.encoder https://ide.codingblocks.com/s/364959
updated code