# 2128. Remove All Ones With Row and Column Flips ###### tags: `Leetcode` `Medium` Link: https://leetcode.com/problems/remove-all-ones-with-row-and-column-flips/ ## 思路 对于任意两个row来说 要不就是两个row完全相同 要不就是两个row完全相反 ## Code ```java= class Solution { public boolean removeOnes(int[][] grid) { for(int i=1; i<grid.length; i++){ for(int j=1; j<grid[0].length; j++){ if(Math.abs(grid[i][j]-grid[0][j])!=Math.abs(grid[i][j-1]-grid[0][j-1])) return false; } } return true; } } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up