FastPrepValidate Rows and Columns
Problems/Validate Rows and Columns

Validate Rows and Columns

WhatNot logoWhatNot● EasyNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asks for row and column validation of an n-by-n Sudoku-like board. Our version is about 85% the same as the description. The value range for a complete board, the uniqueness rule, limits, and examples are stated here.

You are given a nonempty square integer matrix grid with n rows and n columns. Return true if every row and every column is valid; otherwise return false.

For this exercise, a valid row or column contains every integer from 1 through n exactly once. A value outside that range makes the grid invalid.

The grid is fully filled. Check rows and columns only; there is no subgrid or diagonal requirement.

Function

isValidGrid(grid: int[][]) → boolean

Examples

Example 1

grid = [[1,2],[2,1]]return = true
grid
01012121

Every row and column contains 1 and 2 exactly once.

Example 2

grid = [[1,2],[1,2]]return = false
grid
01012112

The rows are valid, but each column repeats a value.

Example 3

grid = [[0]]return = false
grid
000

A one-cell grid must contain 1; 0 is outside its allowed range.

Constraints

  • For this exercise, assume 1 <= n <= 50.
  • grid.length == n and grid[i].length == n.
  • For this exercise, assume -10^9 <= grid[i][j] <= 10^9.

More WhatNot Phone Screen questions

  • Merge Sorted Squares of Two ArraysPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Adjacent Pair and Run RemovalPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • User Journey PathsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • User Journey Paths from a Log StreamPHONE SCREEN · Seen Nov 2026
  • Reachable Exits in an Obstacle GridPHONE SCREEN · Seen Oct 2026
  • Palindrome with One DeletionPHONE SCREEN · Seen Oct 2026
  • Search a 2D MatrixPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Attraction Route Without Reusing TrailsPHONE SCREEN · Seen Sep 2026
  • Earliest Car for Each PassengerPHONE SCREEN · Seen Sep 2026
  • Minimum Stores for a Shopping ListPHONE SCREEN · Seen Sep 2026

Similar questions at other companies

  • Unique Pairs in a 2D Matrix Summing to TargetAmazon · PHONE SCREEN
  • Validate a Latin-Square MatrixKarat · PHONE SCREENKarat interview questions
  • Word Chain Jumps in a GridGoogle · PHONE SCREENGoogle interview questions
  • Sparse Plant Infection SimulationOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Sparse Matrix Addition and MultiplicationPinterest · PHONE SCREENPinterest interview questions
  • Sudoku Board ValidationConfluent · PHONE SCREEN · ONSITE INTERVIEWConfluent interview questions
  • Sparse Matrix MultiplicationByteDance · PHONE SCREENByteDance interview questions
  • Valid SudokuVerkada · PHONE SCREENVerkada interview questions
  • Configurable Tic-Tac-Toe GameEliseAI · PHONE SCREEN
  • Validate Completed SudokuApple · PHONE SCREENApple interview questions

Interview reports that mention this question

  • Whatnot interviews · October 2025
  • Whatnot interviews · March 2026 (Part 1 of 2)
  • Whatnot SWE Interview Questions: 6 Experiences

WhatNot interview experiences

  • Whatnot OA · 2024
  • Whatnot OA · November 2023
  • Whatnot interviews · November 2023
All WhatNot interview questionsSee WhatNot hiring insights
Saved
class Solution {
    public boolean isValidGrid(int[][] grid) {
        // write your code here
    }
}
Checking account…