feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent b434eb3a49
commit a7d29b7cce
203 changed files with 4526 additions and 0 deletions

View File

@@ -9,6 +9,30 @@ categories:
patterns:
- linkedlist-reversal
function_signature: "def copy_random_list(head: Node | None) -> Node | None:"
test_cases:
visible:
- input: { head: [[7, null], [13, 0], [11, 4], [10, 2], [1, 0]] }
expected: [[7, null], [13, 0], [11, 4], [10, 2], [1, 0]]
- input: { head: [[1, 1], [2, 1]] }
expected: [[1, 1], [2, 1]]
- input: { head: [[3, null], [3, 0], [3, null]] }
expected: [[3, null], [3, 0], [3, null]]
hidden:
- input: { head: [] }
expected: []
- input: { head: [[1, null]] }
expected: [[1, null]]
- input: { head: [[5, 0]] }
expected: [[5, 0]]
- input: { head: [[1, 1], [2, 0]] }
expected: [[1, 1], [2, 0]]
- input: { head: [[1, null], [2, null], [3, null], [4, null], [5, null]] }
expected: [[1, null], [2, null], [3, null], [4, null], [5, null]]
- input: { head: [[-1, 0], [0, 1], [1, 0]] }
expected: [[-1, 0], [0, 1], [1, 0]]
description: |
A linked list of length `n` is given such that each node contains an additional random pointer, which could point to any node in the list, or `null`.