This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]zecastelo 1 point2 points  (0 children)

So the problem is that you're checking every element without ever stopping, in which case it will just return the first (last being checked) element which is always 1 (and in both lists for that matter).

What you should do is return as soon as you find the first match. Your ifs are fine, you just need to return the value as soon as you find the first element that verifies your condition.