Commit b3fe862
authored
Update and rename 5.cpp to 1686 Building Teams.cpp
test case for "impossible":
3 3
1 2
1 3
2 3
basically using level order traversal technique using bfs if on the odd level we will give 1 to all the elements and on even level we will give 2
or we can use it using dfs simply maintaining a fucntion
dfs(node,flag);
where flag will be reverse after each iteration
color=flag?1:2;1 parent 9bf6d35 commit b3fe862
1 file changed
+14
-0
lines changedLines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
8 | 22 | | |
9 | 23 | | |
10 | 24 | | |
| |||
0 commit comments