New update is available. Click here to update.

Posted: 7 Dec, 2020

Difficulty: Moderate

```
If edges[i][j] = 1, that implies there is a bi-directional edge between ‘i’ and ‘j’, that means there exists both edges from ‘i’ to ‘j’ and to ‘j’ to ‘i’.
```

```
Given:
‘N’ = 3
‘edges’ = [[0, 1, 1], [0, 0, 1], [0,0,0]].
```

```
The first line of input contains an integer ‘T’ denoting the number of test cases.
The first line of each test case contains two space-separated integers, ‘N,’ where ‘N’ is the number of rows in ‘edges’ and the number of columns in ‘edges’.
The next ‘N’ line of each test case contains ‘N’ space-separated integers which tell if there is an edge between ‘i’ and ‘j’.
```

```
For each test case, You are supposed to return a bool value determining whether the graph is bipartite or not.
```

```
You are not required to print the expected output; it has already been taken care of. Just implement the function.
```

```
1 <= ‘T’ <= 10
2 <= ‘N’ <= 300
0 <= ‘edges[i][j]’ <= 1.
Time Limit: 1sec.
```

SIMILAR PROBLEMS

Eulerian Circuit

Posted: 19 Jan, 2022

Difficulty: Hard

Minimum Swaps To Make Identical Array

Posted: 22 Jan, 2022

Difficulty: Moderate

Find Center of Star Graph

Posted: 26 Jan, 2022

Difficulty: Easy

Critical Connections in a Network

Posted: 27 Jan, 2022

Difficulty: Hard

Critical Connections in a Network

Posted: 27 Jan, 2022

Difficulty: Hard

COUNT ISLANDS

Posted: 14 Sep, 2022

Difficulty: Moderate

Categories:

Popular Courses: