Tap here to switch tabs
Problem
Submissions

Problem: Right Triangles

Try to solve the Right Triangles problem.

Statement

Given a 2D2 D binary array grid, return the total number of right triangles that can be formed by choosing 33 elements with value 11.

A collection of 33 elements with value 11 forms a right triangle if one element shares the same row with the second element and shares the same column with the third element.

Constraints:

  • 1≤1 \leq grid.length ≤1000\leq 1000

  • 1≤1 \leq grid[i].length ≤1000\leq 1000

  • 0≤0 \leq grid[i][j] ≤1\leq 1

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Right Triangles

Try to solve the Right Triangles problem.

Statement

Given a 2D2 D binary array grid, return the total number of right triangles that can be formed by choosing 33 elements with value 11.

A collection of 33 elements with value 11 forms a right triangle if one element shares the same row with the second element and shares the same column with the third element.

Constraints:

  • 1≤1 \leq grid.length ≤1000\leq 1000

  • 1≤1 \leq grid[i].length ≤1000\leq 1000

  • 0≤0 \leq grid[i][j] ≤1\leq 1