shorter xor
This commit is contained in:
parent
aa78a1b463
commit
e1171830b9
1 changed files with 1 additions and 1 deletions
|
@ -31,7 +31,7 @@ list
|
|||
fn {p1, p2, character, password} ->
|
||||
first = Enum.at(password, p1-1) == character
|
||||
second = Enum.at(password, p2-1) == character
|
||||
(first and !second) or (!first and second)
|
||||
first != second # exclusive or is equivalent to two things not matching (not both true or both false)
|
||||
end
|
||||
)
|
||||
|> Enum.count()
|
||||
|
|
Loading…
Reference in a new issue