Tap here to switch tabs
Problem
Submissions

Problem: Equal Row and Column Pairs

med
30 min
Try to solve the Equal Row and Column Pairs problem.

Statement

Given a 00 indexed nimesnn imes n integer matrix grid, return the total number of pairs (ri,cj)(r_i, c_j) such that row rir_i and column cjc_j are equal.

A row and column pair is considered equal if they contain the same elements in the exact same order.

Constraints:

  • n = grid.length = grid[i].length

  • 1≤1 \leq n ≤200\leq 200

  • 1≤1 \leq grid[i][j] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Equal Row and Column Pairs

med
30 min
Try to solve the Equal Row and Column Pairs problem.

Statement

Given a 00 indexed nimesnn imes n integer matrix grid, return the total number of pairs (ri,cj)(r_i, c_j) such that row rir_i and column cjc_j are equal.

A row and column pair is considered equal if they contain the same elements in the exact same order.

Constraints:

  • n = grid.length = grid[i].length

  • 1≤1 \leq n ≤200\leq 200

  • 1≤1 \leq grid[i][j] ≤105\leq 10^5