mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-13 22:00:19 -04:00
fix(curriculum): allow any node order in python depth-first search tests (#64964)
Co-authored-by: majestic-owl448 <26656284+majestic-owl448@users.noreply.github.com>
This commit is contained in:
@@ -42,19 +42,25 @@ You should have a function named `dfs` that takes two arguments.
|
||||
`) })
|
||||
```
|
||||
|
||||
`dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 1)` should return `[1, 2, 3, 0]`.
|
||||
`dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 1)` should return a list with `1`, `2`, `3`, and `0`.
|
||||
|
||||
```js
|
||||
({ test: () => runPython(`
|
||||
assert dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 1) == [1, 2, 3, 0]
|
||||
result = dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 1)
|
||||
assert isinstance(result, list)
|
||||
assert len(result) == 4
|
||||
assert set(result) == {1, 2, 3, 0}
|
||||
`) })
|
||||
```
|
||||
|
||||
`dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 3)` should return `[3, 2, 1, 0]`.
|
||||
`dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 3)` should return a list with `1`, `2`, `3`, and `0`.
|
||||
|
||||
```js
|
||||
({ test: () => runPython(`
|
||||
assert dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 3) == [3, 2, 1, 0]
|
||||
result = dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 3)
|
||||
assert isinstance(result, list)
|
||||
assert len(result) == 4
|
||||
assert set(result) == {3, 2, 1, 0}
|
||||
`) })
|
||||
```
|
||||
|
||||
@@ -66,19 +72,21 @@ You should have a function named `dfs` that takes two arguments.
|
||||
`) })
|
||||
```
|
||||
|
||||
`dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 3)` should return `[3, 2]`.
|
||||
`dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 3)` should return a list with `3` and `2`.
|
||||
|
||||
```js
|
||||
({ test: () => runPython(`
|
||||
assert dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 3) == [3, 2]
|
||||
result = dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 3)
|
||||
assert result == [3, 2] or result == [2, 3]
|
||||
`) })
|
||||
```
|
||||
|
||||
`dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 0)` should return `[0, 1]`.
|
||||
`dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 0)` should return a list with `0` and `1`.
|
||||
|
||||
```js
|
||||
({ test: () => runPython(`
|
||||
assert dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 0) == [0, 1]
|
||||
result = dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 0)
|
||||
assert result == [0, 1] or result == [1, 0]
|
||||
`) })
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user