This one may prove to be a bit of a toughy. Given an array consisting of 0s and 1s, determine a grouping that flipping all the numbers in that group would cause the array to contain the most amount of 1s. The function should then return the number of 1s in that array.
flip([1,0,0,1,0,0,1]) //Flips to [1,1,1,0,1,1,1] >> 6
Comments: