Skip to content

Commit 1391259

Browse files
committed
update 2683
1 parent d11aabe commit 1391259

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# @param {Integer[]} derived
22
# @return {Boolean}
33
def does_valid_array_exist(derived)
4+
# assume the original is [a,b,c,d]
5+
# the derived will be: [(a^b),(b^c),(c^d),(d^a)]
6+
# hence the xor-sum (a^b^b^c^c^d^d^a) will be zero
47
derived.reduce(&:^).zero?
58
end

0 commit comments

Comments
 (0)