Algorithm works correctly regardless of what the grid looks like. SUCCESS