Special Positions in a Binary Matrix SOLUTION

Special Positions in a Binary Matrix SOLUTION

Given a columns x cols grid tangle, where mat[i][j] is either 0 or 1, return the quantity of unique situations in tangle. 

A position (i,j) is called unique if mat[i][j] == 1 and all different components in line I and segment j are 0 (lines and sections are 0-filed). 

 

Model 1: 

Info: tangle = [[1,0,0], 

[0,0,1], 

[1,0,0]] 

 

Yield: 1 

Clarification: (1,2) is an extraordinary position in light of the fact that mat[1][2] == 1 and all different components in line 1 and segment 2 are 0. 

 

Model 2: 

Information: tangle = [[1,0,0], 

[0,1,0], 

[0,0,1]] 

 

Yield: 3 

Clarification: (0,0), (1,1) and (2,2) are unique positions. 

 

Model 3: 

Information: tangle = [[0,0,0,1], 

[1,0,0,0], 

[0,1,1,0], 

[0,0,0,0]] 

 

Yield: 2 

 

Model 4: 

Information: tangle = [[0,0,0,0,0], 

[1,0,0,0,0], 

[0,1,0,0,0], 

[0,0,1,0,0], 

[0,0,0,1,1]] 

 

Yield: 3 

 

Requirements: 

lines == mat.length 

cols == mat[i].length 

1 <= lines, cols <= 100 

mat[i][j] is 0 or 1.

 

SOLUTION DOWNLOAD

March Long Challenge 2021 Solutions

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

1. Frog Sort Solution Codechef

2. Chef and Meetings Solution Codechef

3. Maximise Function Solution Codechef

4. Highest Divisor Solution Codechef

5. Cut the Cake Challenge Solution Codechef

6. Dream and the Multiverse Solution Codechef

7. Cell Shell Solution Codechef

8. Multiple Games Solution Codechef

9. Another Tree with Number Theory Solution Codechef

10. XOR Sums Solution Codechef

11. Prime Game Solution CodeChef

12. Team Name Solution Codechef

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS

RELATED :

Related :

Related :

Leave a Comment

close
error: Content is protected !!