For the first solution, I understand that we need to find a way to keep the coordinates in the hash, but I don't quite understand this formula. Did I miss any math concepts here?
shape.add((r  r0) * 2 * grid[0].length + (c  c0));
Shurui Liu
@shurui
Shut up and code!
5
Reputation
39
Posts
395
Profile views
1
Followers
2
Following
Posts made by shurui

RE: Number of Distinct Islands

RE: Wrong answer by judge ???
@tfarcenim I came across to this testcase too and the online judge says the expected steps should be zero. I am confused.

RE: My Concise Java Solution
@jianchao.li.fighter Because for 0, 1 and 8, their corresponding number at the "mirrored" position should be the same. 0 pairs with 0, 1 pairs with 1, and 8 pairs with 8.