We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defxorMatrix(m,first_row):## Write your code here.#n=len(first_row)ifm<=1:returnfirst_row[:]k=m-1row=first_row[:]b=0while(1<<b)<=k:if(k>>b)&1:s=(1<<b)%nshifted=[row[(i+s)%n]foriinrange(n)]row=[row[i]^shifted[i]foriinrange(n)]b+=1returnrow
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
XOR Matrix
You are viewing a single comment's thread. Return to all comments →