Alibaba online assessment question

Given an array X of any size filled with 0 and 1, where 0 and 1 represent off and on state for a lightbulb. Every column has a switch that can flip the lightbulbs in that column. You are also given an other array Y. Find the least number of switches to turn so that X becomes Y. Note that the rows of X can be permuted freely.

Example: input: X = [[0,0], [1,0], [1,1]], Y = [[0,1], [1,0], [1,1]]
return: 1

Comments (1)