feat(content): more test cases

This commit is contained in:
2025-07-13 19:25:39 +01:00
parent d2b74b6863
commit 85fea3a4bb
94 changed files with 1840 additions and 0 deletions

View File

@@ -10,6 +10,24 @@ categories:
patterns:
- fast-slow-pointers
function_signature: "def has_cycle(head: ListNode | None) -> bool:"
test_cases:
visible:
- input: { head: [3, 2, 0, -4], pos: 1 }
expected: true
- input: { head: [1, 2], pos: 0 }
expected: true
- input: { head: [1], pos: -1 }
expected: false
hidden:
- input: { head: [], pos: -1 }
expected: false
- input: { head: [1, 2, 3, 4, 5], pos: -1 }
expected: false
- input: { head: [1, 2, 3, 4, 5], pos: 4 }
expected: true
description: |
Given `head`, the head of a linked list, determine if the linked list has a cycle in it.