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.
Put 0 in place of the given example matrix[1][0] that is in place of 56 and watch the algo fail. even chatgpt agreed with me !
* the “pick-the-max-of-four” per orbit is not a correct algorithm; it just gives you an upper bound.
If you want the true maximum, you have to account for the fact that every row flip simultaneously affects both orbits in that row, and every column flip affects both orbits in that column. In other words, your decisions for (0,0) and (0,1) are coupled through row 0, and your decisions for (1,0) and (1,1) are coupled through row 1 (and similarly for the two columns). *
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Flipping the Matrix
You are viewing a single comment's thread. Return to all comments →
Put 0 in place of the given example matrix[1][0] that is in place of 56 and watch the algo fail. even chatgpt agreed with me ! * the “pick-the-max-of-four” per orbit is not a correct algorithm; it just gives you an upper bound.
If you want the true maximum, you have to account for the fact that every row flip simultaneously affects both orbits in that row, and every column flip affects both orbits in that column. In other words, your decisions for (0,0) and (0,1) are coupled through row 0, and your decisions for (1,0) and (1,1) are coupled through row 1 (and similarly for the two columns). *