title: Algorithms question: flipping columns
body: <p>Suppose that we are given an m x n grid of zeros and ones and want to transform the grid so that the maximum number of rows are composed solely of ones.  The only operation we are allowed to perform on the grid is picking some column and flipping all of the zeros and ones in that column.  We are also given some integer k and must perform <strong>exactly</strong> k columns flips.  Given the grid and the value of k, how do we determine which columns to flip to maximize the number of rows that are all ones?</p>
  
  <p>I'm thinking something dynamic would need to be done, but I'm not able to arrive at a good answer. Can someone help out?</p>