educative.io

Educative

How come using || eliminating the evaluation of other nodes and returning the result

how come using || eliminating the evaluation of other nodes and returning the result

1 Like

Hi @123tharun,

Thank you for reaching out to us.

If we want to check whether the sum exists in any of the tree paths, we will use ||, but if we’re going to check whether the sum exists in all of the paths, we will use &&.

Please let me know if you need further clarification. Thanks.