# Apply gravity to this matrix This was inspired by [this question][1]. Given an \$m\times n\$ matrix of \$0\$'s and \$1\$'s, apply "gravity" to it. This means to drop down all the \$1\$'s as if they were affected by gravity. For example [[1,0,1,1,0,1,0] [0,0,0,1,0,0,0] [1,0,1,1,1,1,1] [0,1,1,0,1,1,0] [1,1,0,1,0,0,1]] Should result in [[0,0,0,0,0,0,0] [0,0,0,1,0,0,0] [1,0,1,1,0,1,0] [1,1,1,1,1,1,1] [1,1,1,1,1,1,1]] As all \$1\$'s have been dropped down. Input will be atleast \$1\times 1\$. You may take input in all reasonable forms (Bitsets, arrays, Lists) and either output the result, return a new Bitset, array or list or simply modify the input. This is code golf, so the answer with the fewest bytes wins! More test-cases: [[1,0] [[0,0] [0,0] -> [1,0] [1,0]] [1,0]] [[1,1,1,1,1] [[1,0,1,1,0] [1,0,1,1,0] -> [1,1,1,1,0] [1,1,1,1,0]] [1,1,1,1,1]] [[1]] -> [[1]] [1]: https://codegolf.stackexchange.com/questions/235446/neural-processing-lattice-checker