please be clear in problemm statement
For input 1110 you are able to reach last index but expected output is 0
sorry my bad the problem statement is clear i forgot to put a space while giving input.
i tried to delete this post but it says i dont have permission. Sorry…