Return an array containing all the safe nodes of a directed graph. The answer should be sorted in ascending order.
{
"V": 7,
"adj": [
[
1,
2
],
[
2,
3
],
[
5
],
[
0
],
[
5
],
[],
[]
]
}[
2,
4,
5,
6
]{
"V": 4,
"adj": [
[
1,
2
],
[
2,
3
],
[
3
],
[]
]
}[
0,
1,
2,
3
]{
"V": 3,
"adj": [
[
1
],
[
2
],
[
0
]
]
}[]Sign in to Run Code and Submit