**What is your hint or solution suggestion?**

**Challenge:** Depth-First Search

**Link to the challenge:**

```
function notfound (r,i)
{
let k = 0;
for(k;k<r.length;++k)
if(r[k]==i)
return false
return true;
}
function dfs(graph, root) {
let r = [];
let stack = [];
stack.push(graph[root]);
r.push(root);
while(stack.length>0)
{
console.log("stack =",stack);
for(let i = 0 ; i < graph[root].length; ++i)
{
if(notfound(r,i)&&stack[stack.length-1][i]==1)
{
stack.push(graph[i]);
r.push(i);
console.log("r =",r);
i=0;
}
}
console.log("poped",stack.pop(),"from stack");
}
console.log(r);
return r;
}
```