An event app lets organizers assign guests from table groups 1 to n to an n x n seating chart, grid. A 0 means the seat is empty.
The chart is valid if no row and no column has the same non-zero group number twice. Write validSeatingChart(grid) that returns true if the chart is valid and false otherwise.
Input: grid = [[1,2,0],[0,3,1],[2,0,3]] Output: true
Every row and every column has different non-zero numbers.
Input: grid = [[1,2],[1,0]] Output: false
Column 0 has group 1 twice.
1 <= n <= 1000 <= grid[r][c] <= nRun tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #25 Valid Seating Chart. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.