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:
Dario
2026-01-05 13:36:29 +01:00
committed by GitHub
parent 8112a82104
commit be4b2e8307

View File

@@ -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]
`) })
```