Ctrl K

Striped Tile Floor

Easy
A floor is laid out as a table tiles with m rows and n columns; each number is a tile's color. The floor is striped if every tile meets both conditions: - the tile directly below it (if any) has the same color; - the tile directly to its right (if any) has a different color. Return True if the floor is striped, and False otherwise.
Example 1
tiles=[[3, 7, 3], [3, 7, 3]] → True

Each column is a single color, and neighboring columns differ: 3 ≠ 7, 7 ≠ 3.

Example 2
tiles=[[4, 4], [4, 4]] → False

The columns are uniform, but side-by-side tiles in a row match.

Example 3
tiles=[[2, 5], [2, 6]] → False

The second column holds 5 and 6, so it is not a single color.

Constraints
  • 1 ≤ m, n ≤ 10
  • 0 ≤ tiles[i][j] ≤ 9
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsCrossword That Reads Both Ways EasyIsland Coastline Length EasyRepack the Tray EasyBlur the Pixels EasyPaint Bucket Tool Easy
loading Python…
Input
tiles=[[3, 7, 3], [3, 7, 3]]
Expected
True

Run checks the first 3 tests in your browser. Submit checks all 118 tests on the server, hidden ones included.