BUy1 Get1 . Can somebody review my code.

My code runs within time produces desired results uses the obvious logic but still i am getting wrong answer!! please could someone help me with my following code:-

You shouldn’t consider cases differently

so a wrong answer is given if a code produces correct output but uses a different approach which is accepted?
coz this is happening with me in many problems, logic is exactly as that of accepted code, only method is different :frowning:

here is your AC code with slight changes

1 Like

Thanks dude! I would have never figured out that the writing style of if conditions was causing the problem. Could you please also explain why was 97<=*c<=122 was resulting in a WA?

this does not work because only the first part of condition is taken care of
(ie 97<=*c) the limiting condition is neglected ie(*c<=122)

you can try it yourself