Binary search (next alphabet)

why showing wrong output
ques-https://leetcode.com/problems/find-smallest-letter-greater-than-target/

ans-https://leetcode.com/submissions/detail/339673002/

please help

@hunt
can u pls share ur code again. this link is not opening
https://leetcode.com/submissions/detail/339673002/ ](https://leetcode.com/submissions/detail/339673002/)

@Yash_N

@Yash_N please help in it

Hi @hunt
refer to dis modified code.

Hi @hunt
if u still have any doubt, feel free to post it here

hy @Yash_N
why this condition - letters[e]>target

@hunt
we r using dis condition letters[e]>target in order to stop or while loop when let[e] becomes smaller than or equal to target the target.
u will see that we are using
ans=mid;
e=mid-1;
in else, hence when let[e] becomes<=target, we would have stored the greater element in ans.
hope dis helps.