From 898a9ef86f432649b7ea71e57eb87d3171fc105d Mon Sep 17 00:00:00 2001 From: Matt <50872444+MattDClarke@users.noreply.github.com> Date: Fri, 11 Feb 2022 02:58:28 +0200 Subject: [PATCH] fix: added test for depth first search challenge (#45063) --- .../data-structures/depth-first-search.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/curriculum/challenges/english/10-coding-interview-prep/data-structures/depth-first-search.md b/curriculum/challenges/english/10-coding-interview-prep/data-structures/depth-first-search.md index 7d86343817..4467b7eeba 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/data-structures/depth-first-search.md +++ b/curriculum/challenges/english/10-coding-interview-prep/data-structures/depth-first-search.md @@ -49,6 +49,23 @@ assert.sameMembers( ); ``` +The input graph `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]` with a start node of `3` should return an array with `3`, `2`, `1`, and `0`. + +```js +assert.sameMembers( + (function () { + var graph = [ + [0, 1, 0, 0], + [1, 0, 1, 0], + [0, 1, 0, 1], + [0, 0, 1, 0] + ]; + return dfs(graph, 3); + })(), + [3, 2, 1, 0] +); +``` + The input graph `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]` with a start node of `1` should return an array with four elements. ```js